Steven Jewel Blog RSS Feed

29 Mar 2014

Zing, command automation

One trick to speed up programming is to make sure that you can iterate on code as fast as possible. I've created a little tool that has helped me iterate faster called zing.

zing works by letting me create a script called .zing in any directory. I put in there whatever command I happen to want to run repeatedly. For some projects, I can just have it be rake test, but the content varies a lot. It might be testing a certain request with a cURL script that I exported from chromium's developer tools, or it could just focus on a single test in the test suite.

I tend to change the content of the script throughout the day while working on a project, which is where I think it wins out over other techniques.

I have this mapped to a special key combination, ,z in vim, in both Insert and Normal modes. When I hit that combination, the file is automatically saved and the command is run. I then hit enter and continue programming.

I will now publish this blog post by pressing ,z, which runs the following .zing script, located in ../.zing:

#!/bin/bash -e
jekyll build --destination /tmp/jekyll-blog/
rsync -aP --del /tmp/jekyll-blog/ webserver:www/blog/

Installation instructions are available on github.