Commit d4aff718 authored by Andreas Tille's avatar Andreas Tille
Browse files

Add script to create README.source for R packages automatically

parent 39f5719e
Loading
Loading
Loading
Loading

create_README.source

0 → 100755
+37 −0
Original line number Diff line number Diff line
#!/bin/sh

# you can use/adapt this script to create README.source for R packages
# featuring large amounts of binary data files

cat <<EOT
Explanation for binary files inside source package according to
  http://lists.debian.org/debian-devel/2013/09/msg00332.html

EOT

for rda in `ls ../data/*.rda ../data/*.RData 2>/dev/null` ; do
  rdoc="../man/$(basename $rda .rda)"
  if [ ! -e ${rdoc}.Rd ] ; then
    rdoc="../man/$(basename $rda .RData).Rd"
  else
    rdoc=${rdoc}.Rd
  fi
  if [ ! -e "$rdoc"  ] ; then
    >&2 echo "Verify documentation for $rda manually"
  else
        echo "Files: data/$(basename $rda)"
        echo "Documented: $rdoc"
        grep '\\title' $rdoc | sed -e 's/^\\title{/  /' -e 's/ *} *$//'
        echo ""
  fi
done

cat <<EOT
 -- Andreas Tille <tille@debian.org>  `date -R`
EOT


#        sed -e '0,/^\\title{/d' -e '/^}/,$d' -e 's/^\\description{//' -e 's/^\([^ ]\)/  \1/' $rdoc | \
#           sed -e 's/\\code{\([^}]\+\)}/\1/g' | \
#           perl -p -e 's/\cM//g' | grep -v '^ *$' | sed -e '/^ \+\\/d' -e 's/} *$/\n#####/' | \
#           sed -e '/^#####/ { N; N; N; N; d; }' | sed -e '/^#####/ { N; N; N; d; }' | sed -e '/^#####/ { N; N; d; }'  | sed -e '/^#####/ { N; d; }'