« Back to Index

CabinJS static generator example

View original Gist on GitHub

CabinJS.md

Using CabinJS to create my blog, but it only works with GitHub pages (so as I have a user account set-up for my domain repo CabinJS’ deployment process doesn’t work for me, which means I need to copy the dist folder over to my website repo manually).

So rather than write a Rake task (or a Node/Grunt task) and have to spend time looking up the different File system APIs (which I always forget), I’ve decided to use standard unix commands to achieve the same thing.

Yes I’m sure it looks a lot more long winded but it works and took me a lot less time to write…

alias site="cd ~/Code/CabinJS && 
            touch log.txt && 
            git log --oneline -n 1 | 
            cut -d ' ' -f 2- | 
            xargs -I {} echo {} > log.txt && 
            cd ../Website && 
            cp -r ../CabinJS/dist/* ./ && 
            git add . && 
            git add -A && 
            cat ../CabinJS/log.txt | 
            xargs -I {} git commit -m {} && 
            git push origin master"

…to explain what it’s doing…