As I’ve been working on this Jekyll blog a bit more recently I’ve found myself wrapping up the most commonly used commands into scripts.
Update: Github has some great scripts for this too.
The scripts are incredibly simple but it’s just one less thing to remember as I move back and forth on various applications and projects. Instead of trying to remember which commands, configuration, and exact execution I can just rely on a simple script. If something is broken then I fix it once and commit the newly working version. Here are some of the ones I’m using for Jekyll currently.
bin/deploy:
When I’m ready to deploy it’s just a simple bin/deploy
and my site’s live. I used to host this blog on Heroku and go through the full git push deployment which takes quite a bit of time. I’ve really been enjoying a simpler hosting setup by just building the site and rsync'ing it up to the host(deploying this post took 1.4 seconds).
#! /bin/sh
bundle exec jekyll build
rsync -va --delete-after _site/ nickhammond.com:~/nickhammond.com
bin/drafts:
When I’m working on a draft that I’m not ready to publish yet I can utilize my drafts command. This just boots Jekyll’s server with the drafts flag.
#! /bin/sh
bundle exec jekyll serve --drafts
bin/server:
And the even simpler bin/server
command which renders the fully published blog as it will appear on the server.
#! /bin/sh
bundle exec jekyll serve
bin/publish:
Where I find it really comes in handy when you start mixing in Octopress & Jekyll. I no longer have to keep track of which commands still reside in Octopress and which ones are part of Jekyll, it’s just a simple abstraction.
#! /bin/sh
bundle exec octopress publish $*
They’re all incredibly simple commands but it’s just a simple way to get the tools out of your way and focus on the work.