Skip to content

Instantly share code, notes, and snippets.

@manikmagar
Created July 17, 2016 20:26
Show Gist options
  • Save manikmagar/4cf5ce89a316a2fc6006d454684c7fc7 to your computer and use it in GitHub Desktop.
Save manikmagar/4cf5ce89a316a2fc6006d454684c7fc7 to your computer and use it in GitHub Desktop.
Shell script to bake the Static blog using JBake
#!/bin/bash
SITE_NAME=mysite.com
SITE_SYNC_HOME=~/gitsync/$SITE_NAME
JBAKE_TEMPLATE_REPO=https://github.com/manikmagar/clean-text-jbake-template.git
CONTENT_GIT_REPO=https://github.com/manikmagar/mm-blog-data.git
TMP_GIT_CLONE=$SITE_SYNC_HOME/repo
TMP_SITE_BACKUP=$SITE_SYNC_HOME/site/backup
PUBLIC_WWW=~/www/mysite
current_time=$(date "+%Y%m%d")
git clone $JBAKE_TEMPLATE_REPO $TMP_GIT_CLONE
echo "Remove template content"
rm -Rf $TMP_GIT_CLONE/content
echo "Getting new content"
git clone $CONTENT_GIT_REPO $TMP_GIT_CLONE/content
echo "Initiate Baking with JBake"
jbake -b $TMP_GIT_CLONE $TMP_GIT_CLONE/htdocs
if [ -d $TMP_SITE_BACKUP/$SITE_NAME/$current_time/ ]
then
mkdir -p $TMP_SITE_BACKUP/$SITE_NAME/$current_time/
fi
cp -R $PUBLIC_WWW/* $TMP_SITE_BACKUP/$SITE_NAME/$current_time
#sudo ~/gitrepos/copydata.sh $TMP_GIT_CLONE/htdocs/ $PUBLIC_WWW/
cp -R $TMP_GIT_CLONE/htdocs/ $PUBLIC_WWW/
rm -Rf $TMP_GIT_CLONE
echo "Site has been published"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment