Add support for multiple Jekyll sites

pull/64/head
Mark Szymanski 2011-06-24 17:49:19 -05:00
parent 56b83c76cb
commit 9ad7964c86
2 changed files with 300 additions and 155 deletions

View File

@ -56,6 +56,13 @@ PREVIEW="less"
[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview"
[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app"
# Load all the Jekyll stuff
if [ -e $HOME/.jekyllconfig ]
then
. $HOME/.jekyllconfig
fi
#
# Custom Help

View File

@ -1,7 +1,30 @@
#!/bin/bash
editpost() {
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
unset SITE
if [ -z "$1" ]
then
echo "Error: no site specified."
echo "The site is the name of the directory your project is in."
return 1
fi
for site in ${SITES[@]}
do
if [ "$(basename $site)" = "$1" ]
then
SITE=$site
break
fi
done
if [ -z "$SITE" ]
then
echo "No such site."
return 1
fi
builtin cd "$SITE/_posts"
COUNTER=1
NUMBER="$RANDOM"
@ -27,16 +50,42 @@ editpost() {
}
newpost() {
unset SITE
if [ -z "$1" ]
then
echo "Error: no site specified."
echo "The site is the name of the directory your project is in."
return 1
fi
if [ -z "$SITE" ]
then
echo "No such site."
return 1
fi
loc=0
for site in ${SITES[@]}
do
if [ "$(basename $site)" = "$1" ]
then
SITE=$site
JEKYLL_FORMATTING=${MARKUPS[$loc]}
break
fi
loc=$(($loc+1))
done
# 'builtin cd' into the local jekyll root
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
builtin cd "$SITE/_posts"
# Get the date for the new post's filename
FNAME_DATE=$(date "+%Y-%m-%d")
# If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr.
# If the user is using markdown or textile formatting, let them choose what type of post they want. Sort of like Tumblr.
OPTIONS="Text Quote Image Audio Video Link"
@ -206,3 +255,92 @@ newpost() {
"$EDITOR" $FNAME
}
function testsite() {
unset SITE
if [ -z "$1" ]
then
echo "Error: no site specified."
echo "The site is the name of the directory your project is in."
return 1
fi
for site in ${SITES[@]}
do
if [ "$(basename $site)" = "$1" ]
then
SITE=$site
break
fi
done
if [ -z "$SITE" ]
then
echo "No such site."
return 1
fi
builtin cd $SITE
jekyll --server --auto
}
function buildsite() {
unset SITE
if [ -z "$1" ]
then
echo "Error: no site specified."
echo "The site is the name of the directory your project is in."
return 1
fi
for site in ${SITES[@]}
do
if [ "$(basename $site)" = "$1" ]
then
SITE=$site
break
fi
done
if [ -z "$SITE" ]
then
echo "No such site."
return 1
fi
builtin cd $SITE
rm -rf _site
jekyll --no-server
}
function deploysite() {
unset SITE
if [ -z "$1" ]
then
echo "Error: no site specified."
echo "The site is the name of the directory your project is in."
return 1
fi
loc=0
for site in ${SITES[@]}
do
if [ "$(basename $site)" = "$1" ]
then
SITE=$site
REMOTE=${REMOTES[$loc]}
break
fi
loc=$(($loc+1))
done
if [ -z "$SITE" ]
then
echo "No such site."
return 1
fi
builtin cd $SITE
rsync -rz $REMOTE
}