melpa/melpa
2012-01-21 23:19:05 -06:00

90 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
BASEDIR=`dirname $0`
cd ${BASEDIR} || exit 1
function melpa_clear_packages {
echo "*** Clearing the packages folder..."
rm -r packages/*
echo
}
function melpa_build_pkglist {
echo "*** Building all packages..."
for pkg in `cat buildlist`; do
./buildpkg $pkg
echo
echo
done
echo
}
function melpa_build_archive {
echo "Building package: $pkg"
emacs --batch -l package-build.el -u dcurtis --eval "(package-build-archive \"$1\")"
echo
}
function melpa_sync {
echo "*** Pushing changes to the server..."
rsync -avz --delete packages webpage/index.html milkbox.net:webapps/melpa/
echo
}
function melpa_generate_html {
echo "*** Building webpage..."
cd webpage || return 1
erb index.erb > index.md
pandoc -s --mathml -t html --smart index.md > index.html
cd ..
echo
}
function print_usage {
echo "usage: $0 [-h | -?] [clear | build | html | sync]"
}
args=`getopt h $*`
errcode=$?
if [[ "$errcode" > 0 ]]; then
print_usage
exit $errcode
fi
set -- $args
for i; do
case "$i" in
-h | -\?) print_usage
shift
exit
;;
--) shift
break
;;
esac
done
if [[ "$#" == "0" ]]; then
set -- clear build index sync
fi
for i; do
case $i in
clear ) melpa_clear_packages ;;
build ) melpa_build_pkglist ;;
html | index ) melpa_generate_html ;;
sync ) melpa_sync ;;
esac
shift
done
exit 1