Homebrewing with Homebrew

I'm a bit of an Apple fan, most of my private development is done using Mac OSX. Apple doesn't distribute OSX with most of the software packages I use. Instead, I use Homebrew to install new packages, their dependencies, check for updates, and remove everything again when I am finished.

However, even the extensive collection of software that Homebrew supports isn't always going to be able to provide an obscure or unusual piece of software that I might want to install. So I created a Homebrew Tap, which I called Arcane, to manage such packages.

Homebrew introduced Taps in 0.9. Taps Taps are a way of creating repositories of Homebrew formula that are independent of the main Homebrew repository. Homebrew maintains a list of interesting taps, but anyone can create their own.

Creating a new Tap is straight forward. First, create a new repository on Github. There is a naming convention for creating a Tap repository, it must begin with homebrew-. The remainder is the name of the Tap. My Tap is called Arcane, so the repository is homebrew-arcane.

Once the new repository is created, it can be tapped using brew tap user/repo. Where user is your GitHub user account and repo is the name of your Tap repository. (The bit after homebrew-) The repository will be cloned into /usr/local/Library/Taps. To tap Arcane I used brew tap aliles/arcane.

Now you can begin creating formula for your new Tap. Homebrew has a guide on how to create a new formula that covers the basics. Unfortunately you will likely need to read existing formula to learn the more advanced features of Homebrew.

After running brew create, a new formula will be created in /usr/local/Library/Formula. As formula are Ruby scripts, you can move the formula from its initial location to your Tap repository in /usr/local/Library/Taps/user-repo. After moving the formula it is necessary to run brew tap --repair to ensure a symbolic link to the formula is created in /usr/local/Library/Formula. Without this link Homebrew is unable to find the formula to install it.

Once you have finished developing your formula, commit it to the repository. Congratulations, you are now the maintainer of a Homebrew Tap of interesting formula. As a bonus you can now also repeatedly and reliably install (and remove) this software again at any time in the future, should you be desire to do so.


Blogging with Pelican, Travis and Heroku

It's been over a year since I posted anything to by Tumblr blog. While Tumblr was a convenient way to start a blog, I now find it difficult to create content the way I want to. In particular, I want to author posts in reStructuredText or Markdown with high quality support for syntax highlighting of code. Therefore, I have decided to change to a different blogging platform.

My new blog is built using the Pelican static site generator. I consider a static site to be simpler and easier to deploy and manage, being a collection of static files. I chose Pelican as it was implemented using Python (my favourite software development language) is actively developed and appeared to have the features I wanted.

For a site theme, I started with the bootstrap2 theme from Pelican Themes. I then updated the version of the Bootstrap framework and the Font Awesome icon set, tweaked the CSS, fixed some bugs, tweaked the CSS some more, and finally chose to stop personally bikeshedding and move forward. I think it's pretty clear that I'm no web designer. There's still some annoying behaviour from the responsive design on mobile phones that I haven't been able to fix.

Most of my open source projects are hosted on Github, including this blog. Using a version control system allows me to crate branches for drafts I'm still working on. I also get to use my preferred text editor. While hosting on Github allows me to use Travis for continuous integration. Github also has excellent web based editing, so I can create and work on articles even if I don't have my laptop.

To publish, I'm using Travis for continuous deployment to Heroku. Travis makes continuous Heroku deployment reasonably simple. The most difficult part of getting this working was realising I needed to explicitly set the deploy strategy to use Git. Travis will default to using the Anvil deploy strategy, which does not work with my buildpack. I ended up forking the Pelican buildpack as the content directory wasn't being set correctly. This caused pages to fail to be built.

Heroku is very generous to offer each Heroku app enough credits to run a single web dynamo for free. This is easily enough to meet the tiny demand of this static site. Admittedly, Heroku applications running on their free tier will enter a sleep state after an hour of inactivity, the few seconds delay to wake from a sleep state doesn't greatly concern me at the moment.

One feature of Tumblr that I really liked was the ability to post to Twitter when I publish a new article. To meet this requirement, I created a recipe using IFTTT that does the same. It polls the site's news feed for new items, posting the title and link to my Twitter account.

To acknowledge the projects and companies that have enabled this blog, I have created a Powered By section in the side bar of this site, which will remain for the foreseeable future. Thank you Python, Pelican, Bootstrap, Font Awesome, Travis, Heroku and IFTTT. This has been fun.