Hashrocket.com / blog

Put your programming tools in a Toolbox

posted on and written by Micah Cooper in

Image 100x100 micah cooper

There are certain files, scripts, and snippets (gists) that we ofter use on many projects we create- especially with rails projects. I find using gists for these types of files cumbersome. I propose another approach:

The birth of my Toolbox

I was teaching a collection of people how to make a rails application at a RubyJax meetup the other day and I found my self in an interesting situation- There was a bit of code that I needed to move forward through the app but I didn’t want to spend the time actually writing it. So I decided to put this code online so the “students” could simply download it (they were following along on their own machines) when we got that that point.

I started by putting a bunch of gists on github. Next I needed to have a list for everyone to reference where to get these files. Then I decided to write a README file for each gist so people could go back later and understand how to use this code. Now I have a bunch of gists, all with different, unintelligible urls, and a bunch of of READMEs and no where to put them.

To solve this, I created a repo called toolbox, and filled it with the READMEs. In each README I had the link to the gist. To make it a little easier I even created a ‘curl’ command with the file so they didn’t have to think about the less important parts of the learning session.

This was great- until I had to update all these gists and found meself with 8 different repos to deal with. So naturally I stuck them all into one repo with along with the READMEs and I had myself a toolbox.

I see my toolbox as a place to maintain and share all my gists. Also, I think it could be a source of pride for people liking to show of their tips and tricks! One repository is a better facility for that than a list of gists in my opinion.

Using my tools

This toolbox worked out pretty well for the Rubyjax session. But I wanted a way to to grab my tools from the command line that was more convenient then curling them. So I did what every overengineering Rubyist does- I created a gem cleverly named Rench to grab the tools from my toolbox.

Now, whenever I want to grab a tool from my toolbox, whether it’s for a new project or teaching the a group of people, all I need to remember is a github username:

gem install rench

rench mrmicahcooper

And Rench will show me all the tools in that user’s toolbox:

Choose a file:
[0] active_record_spec_helper.rb
[1] formbuilder.rb
[2] html5.js
[3] mixins.sass
[4] step_definitions.rb
[5] support_paths.rb
[6] ui_controller.rb
[7] ui_index.html.haml
[8] whitespace-reset.scss

So I can download them to wherever- easily. I think this approach is hugely convenient. Give it a shot! Let me know what you think.


Posted in Development and tagged with Trip Reports, Agile, Workflow, Git, Development, Ruby