mirror of
https://github.com/correl/melpa.git
synced 2024-12-18 19:21:32 +00:00
86 lines
1.4 KiB
Bash
Executable file
86 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
BASEDIR=`dirname $0`
|
|
|
|
cd ${BASEDIR} || exit 1
|
|
|
|
|
|
function melpa_clear_packages {
|
|
echo "*** Clearing the packages folder..."
|
|
rm -rf packages/*
|
|
echo
|
|
}
|
|
|
|
|
|
function melpa_build_pkglist {
|
|
echo "*** Building all packages..."
|
|
emacs --batch -l package-build.el --eval "(package-build-all)"
|
|
echo
|
|
}
|
|
|
|
function melpa_generate_html {
|
|
echo "*** Building html"
|
|
cd html || return 1
|
|
erb index.erb > index.md
|
|
pandoc --template=template.html --css=style.css -s --mathml -t html --smart index.md > index.html
|
|
cd ..
|
|
echo
|
|
}
|
|
|
|
function trim {
|
|
echo $1
|
|
}
|
|
|
|
function melpa_validate {
|
|
NUMPACKAGES=$(trim `ls recipes/* | wc -l`)
|
|
NUMBUILT=$(trim `ls packages/*.{el,tar} | wc -l`)
|
|
|
|
echo "${NUMBUILT}/${NUMPACKAGES} packages built"
|
|
}
|
|
|
|
function print_usage {
|
|
echo "usage: $0 [-h | -?] [clear | build | html | validate]"
|
|
}
|
|
|
|
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 validate
|
|
fi
|
|
|
|
for i; do
|
|
case $i in
|
|
clear ) melpa_clear_packages ;;
|
|
build ) melpa_build_pkglist ;;
|
|
html | index ) melpa_generate_html ;;
|
|
validate ) melpa_validate ;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
|