Project Ramon

A learning journey from a Ruby noob perspective

Rev up your Rails: A short look at Guard & Zeus

rev_rails_header_img

Last week, Edward Anderson introduced me to this video on zeus.

Zeus from Burke Libbey on Vimeo.

Let me say, that there is a tremendous difference in the speed in which my test suite has been running ever since. So lets go over a quick install for guard-zeus and guard-rspec. These are the two gems that Edward showed me how to use to get blazing fast console, rake, and server speeds.

Here’s the repository for guard-zeus, and another for guard-rspec. The setup guides for both are pretty good. There are a couple of things that you may have to troubleshoot however.

rev_rails1

Gemfile Ordering

The order of the Gemfile’s :development & test groups actually made a difference. Before my Gemfile looked like what you see above, I had my shoulda and shoulda-matchers gems at the bottom of the group. The helpers that come with the gems didn’t want to run properly until Edward pointed out that gem order makes a difference, and had me adjust the order to the above image.

Guardfile snapshot

I don’t understand everything thats going on inside of this file, but I think the broad jest is that these different commands starting with guard, give zeus a file path to watch over. Here’s an example that can explain the folder paths a little better than I could write it.

rev_rails2

The if we refer to the github repositories of both the guard-zeus and guard-rspec gems, its the terminal command guard init zeus for guard-zeus and guard init rspec for guard-rspec that will generate the associated commands for our Guardfile. I showed you the guard-zeus guard commands, so here is the command list that zeus will use to run Rspec specs.

rev_rails3

Don’t worry, running zeus isn’t complicated at all. In fact, its just as easy as running our specs the old-fashioned way rspec spec/path/to/your_spec.rb

Start your engines!

Getting guard and zeus going is pretty simple. First you’ll want to open a terminal session and change directory into your desired application folder root. Then you’ll want to type bundle exec guard. Pretty simple! If everything went well your terminal window should look something like this:

rev_rails5

Next we can leave this window running guard for us and type command + t to bring up an new terminal window that we need to change to our app’s root folder as well. Once there you’ll want to type zeus start. This brings up a color coded display that looks something like:

rev_rails4

And finally, we can open yet another terminal window, and if we already have some specs written, take zeus out for a test drive like so. zeus test spec/path_to/your_spec(s).rb.

And for those of you who have watched the zeus video at the beginning of this post, here’s the clocked speed from running my model specs.

rev_rails6

Under a second! Just like the good gentleman in the top-hat says.

If you’re interested in getting these gems setup for your environment, check out the pair with Edward and I. Or better yet, get in touch with him and schedule an hour to try AirPair for yourself. I can honestly say that I have grown leaps and bounds in only a few weeks of consistent pairing and working on my own in between.

Advertisements

Categories: AirPair, Newbie, Ruby on rails

Tags: , , , ,

3 replies

Trackbacks

  1. AirPair.com – What I’ve Learned pt. 2 | Project Ramon
  2. #TDD Lunch Panoply: Out of the Gate Setup | Project Ramon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s