melpa/melpa

87 lines
1.4 KiB
Text
Raw Normal View History

2011-12-11 00:53:39 +00:00
#!/bin/bash
2011-12-14 03:04:08 +00:00
BASEDIR=`dirname $0`
cd ${BASEDIR} || exit 1
2011-12-14 03:04:08 +00:00
function melpa_clear_packages {
echo "*** Clearing the packages folder..."
rm -rf packages/*
2011-12-11 00:53:39 +00:00
echo
}
function melpa_build_pkglist {
echo "*** Building all packages..."
emacs --batch -l package-build.el --eval "(package-build-all)"
2011-12-11 00:53:39 +00:00
echo
}
function melpa_generate_html {
2012-01-22 05:23:14 +00:00
echo "*** Building html"
cd html || return 1
2012-01-21 21:18:52 +00:00
erb index.erb > index.md
2012-01-22 20:28:13 +00:00
pandoc --template=template.html --css=style.css -s --mathml -t html --smart index.md > index.html
cd ..
2011-12-11 00:53:39 +00:00
echo
}
function trim {
echo $1
}
function melpa_validate {
2012-04-07 03:11:09 +00:00
NUMPACKAGES=$(trim `ls recipes/* | wc -l`)
NUMBUILT=$(trim `ls packages/*.{el,tar} | wc -l`)
echo "${NUMBUILT}/${NUMPACKAGES} packages built"
}
2012-01-21 02:40:29 +00:00
function print_usage {
echo "usage: $0 [-h | -?] [clear | build | html | validate]"
2012-01-21 02:40:29 +00:00
}
args=`getopt h $*`
errcode=$?
if [[ "$errcode" > 0 ]]; then
print_usage
exit $errcode
fi
set -- $args
for i; do
case "$i" in
2012-01-21 02:41:36 +00:00
-h | -\?) print_usage
2012-01-21 02:40:29 +00:00
shift
exit
;;
--) shift
break
;;
esac
done
2011-12-14 03:04:08 +00:00
if [[ "$#" == "0" ]]; then
set -- clear build index validate
2011-12-14 03:04:08 +00:00
fi
2012-01-21 02:40:29 +00:00
for i; do
case $i in
2011-12-14 03:04:08 +00:00
clear ) melpa_clear_packages ;;
build ) melpa_build_pkglist ;;
html | index ) melpa_generate_html ;;
validate ) melpa_validate ;;
2011-12-14 03:04:08 +00:00
esac
shift
done
2012-01-21 02:40:29 +00:00
exit 1
2011-12-11 00:53:39 +00:00