2011-12-11 00:53:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-12-14 03:04:08 +00:00
|
|
|
BASEDIR=`dirname $0`
|
|
|
|
|
2011-12-14 03:45:54 +00:00
|
|
|
cd ${BASEDIR} || exit 1
|
|
|
|
|
2012-01-22 19:57:48 +00:00
|
|
|
|
2011-12-14 03:04:08 +00:00
|
|
|
function melpa_clear_packages {
|
|
|
|
echo "*** Clearing the packages folder..."
|
2012-03-19 03:11:30 +00:00
|
|
|
rm -rf packages/*
|
2011-12-11 00:53:39 +00:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function melpa_build_pkglist {
|
|
|
|
echo "*** Building all packages..."
|
2012-03-19 03:12:18 +00:00
|
|
|
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
|
2011-12-14 03:45:54 +00:00
|
|
|
cd ..
|
2011-12-11 00:53:39 +00:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2012-01-30 02:27:15 +00:00
|
|
|
function trim {
|
|
|
|
echo $1
|
|
|
|
}
|
|
|
|
|
|
|
|
function melpa_validate {
|
2012-04-07 03:11:09 +00:00
|
|
|
NUMPACKAGES=$(trim `ls recipes/* | wc -l`)
|
2012-01-30 02:27:15 +00:00
|
|
|
NUMBUILT=$(trim `ls packages/*.{el,tar} | wc -l`)
|
|
|
|
|
|
|
|
echo "${NUMBUILT}/${NUMPACKAGES} packages built"
|
|
|
|
}
|
|
|
|
|
2012-01-21 02:40:29 +00:00
|
|
|
function print_usage {
|
2012-02-14 03:40:06 +00:00
|
|
|
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
|
2012-02-14 03:40:06 +00:00
|
|
|
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 ;;
|
2011-12-14 03:15:15 +00:00
|
|
|
html | index ) melpa_generate_html ;;
|
2012-01-30 02:27:15 +00:00
|
|
|
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
|
|
|
|