Intrigued by the recent rise in popularity of the nanoc library, I decided to start porting my homepage over from Rails to using nanoc. However I wasn't too sure what would be the best way to push my site to Heroku. nanoc comprises of a folder that contains your site configuration, layout, content and the static output from the website.
I did initially think about putting a Git repository in the output folder and simply pushing the output folder to Heroku. What about my layouts and content though? Do I put them under a separate repository? It felt overkill to use two repositories for one website.
I then found this post by Jamie Iniesta that describes how he created the Euruko 2009 site using nanoc. Towards the end of the post, Jamie describes how he used a Rack configuration file to determine how files should be served from the site's nanoc folder.
Instead of pushing just the output folder, I could now push the my whole nanoc folder as one repository and serve only the files from the output folder for my homepage.
Using a Rack configuration file, we redirect incoming requests for pages to include the standard index.html that all pages in nanoc are called, and then use Rack::Static to tell Heroku that we want to serve all static assets from the root of the output folder.
We also include an empty app at the bottom should there be any problems with the site.
nanoc has been a great little library to use for generating a static site and the ability to push to Heroku makes deployment so easy. I've only managed to scratch the surface with nanoc though but I'm looking to add more content to my homepage over the next few months so that I can dig deeper into using nanoc.