melpa/melpa
2012-01-20 17:31:22 -06:00

73 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
BASEDIR=`dirname $0`
cd ${BASEDIR} || exit 1
function melpa_update_epkgs {
echo "Updating epkgs..."
cd epkgs || return 1
git pull
cd ..
echo
}
function melpa_clear_packages {
echo "*** Clearing the packages folder..."
rm packages/*
echo
}
function melpa_build_pkglist {
echo "*** Building all packages..."
for pkg in `cat pkglist`; 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
awk '{ if(/<!--list-of-packages-->/)
while((getline < "../pkglist")>0)
print "* " $0
else print}' index.tmpl > index.md
pandoc -s --mathml -t html --smart index.md > index.html
cd ..
echo
}
args=$@
if [[ "$#" == "0" ]]; then
args="update clear build index sync"
fi
for task in $args; do
case $task in
update ) melpa_update_epkgs ;;
clear ) melpa_clear_packages ;;
build ) melpa_build_pkglist ;;
html | index ) melpa_generate_html ;;
sync ) melpa_sync ;;
esac
shift
done