Add support for multiple Jekyll sites
parent
56b83c76cb
commit
9ad7964c86
|
|
@ -56,6 +56,13 @@ PREVIEW="less"
|
||||||
[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview"
|
[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview"
|
||||||
[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app"
|
[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app"
|
||||||
|
|
||||||
|
# Load all the Jekyll stuff
|
||||||
|
|
||||||
|
if [ -e $HOME/.jekyllconfig ]
|
||||||
|
then
|
||||||
|
. $HOME/.jekyllconfig
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Custom Help
|
# Custom Help
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
editpost() {
|
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
|
COUNTER=1
|
||||||
NUMBER="$RANDOM"
|
NUMBER="$RANDOM"
|
||||||
|
|
@ -27,16 +50,42 @@ editpost() {
|
||||||
}
|
}
|
||||||
|
|
||||||
newpost() {
|
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' into the local jekyll root
|
||||||
|
|
||||||
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
|
builtin cd "$SITE/_posts"
|
||||||
|
|
||||||
# Get the date for the new post's filename
|
# Get the date for the new post's filename
|
||||||
|
|
||||||
FNAME_DATE=$(date "+%Y-%m-%d")
|
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"
|
OPTIONS="Text Quote Image Audio Video Link"
|
||||||
|
|
||||||
|
|
@ -206,3 +255,92 @@ newpost() {
|
||||||
|
|
||||||
"$EDITOR" $FNAME
|
"$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
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue