This is going to be a long post, all about me! feel free to skip it! :)
I feel truly blessed to have the opportunity to be a mentor to my apprentices Alberto and despo. I am finding that i am really enjoying the role, and i feel such a sense of compassion and pride for my apprentices.
Whenever i pair with anyone, i always learn something. Although i am spending much of my time consciously teaching, to also learn from my apprentices by pairing with them gives me such a good feeling.
Thanks to despo, i am now using iTerm instead of Terminal. I have been encouraged finally to use Enrique’s Vim Ruby Refactoring tool, we have set up spork and autospec, and i have learnt about RSpec’s nested format. Together we both found out how to use RSpec shared examples today.
Importantly, despo is helping me to realise that i have a tendency to hold too much in my head, and try to do too much at once. I am grateful to despo for restraining me from racing ahead too fast, and for reminding me to do one thing at a time. It is good for me to realise what i need to do to become better at teaching.
I have not yet had the opportunity to pair for more than a few hours with Alberto, but i know i will get the chance soon, and i know i will learn new things from Alberto too, which excites me no end! :)
It’s interesting how you can sometimes notice something through someone else’s eyes that you’d previously overlooked. This week i have been mostly working with my apprentice Despo on a Rails project. Despo noticed that running specs in Rails takes a long time to initialize, which something i am well aware of but i guess i’ve sort of got used to it.
So we decided to do something about it. The first thing we did was set up Spork. If you want to know how to do that i recommend this post by Chris: How to get Spork working NOW on Rails 3, Rspec 2 and Cucumber.
Autotest notices which files have changed and starts running the relevant specs:
Growl can be configured to show failure messages in red:
Success messages are shown in green:
Growl can also show when specs are pending:
How did we achieve this?
Firstly you will need to install the gems
autotest-growl. Either include them in a bundle, or install them system-wide if you want to use them across all projects.
If you use RVM for different versions of ruby you might find this command useful:
for version in $(rvm list strings); do rvm use $version@global && gem install autotest && gem install autotest-growl; done
Secondly you will need a
.autotest file. You can either put it in your project’s root directory, or in your home directory
Here is mine so you can see what it looks like:
#!/usr/bin/env ruby require 'rubygems' require 'autotest/growl' Autotest::Growl::image_dir = File.join(ENV['HOME'], '.autotest_images') Autotest::Growl::show_modified_files = true Autotest.add_hook :initialize do |autotest| %w(.git .DS_Store db log tmp).each do |exception| autotest.add_exception(exception) end autotest.order = :random end
Thirdly you will need to install Growl and configure it to your liking. I have mine set to Music Video because it’s so impossible to miss!
The only trouble with the Music Video style is it can only display one message at a time, so i make it fade in and last for just 1 second. Happily, with growl colouring, you don’t really need to read the message – the colour tells you immediately what happened.
The colours you need to set are:
- Very Low for passed
- Moderate for pending
- Normal for info
- Emergency for failed (or syntax error)
Here is my Growl configuration:
Finally, if you want cute pictures to come up with your growl messages, you simply need to put them in
~/.autotest_images – named passed.png, pending.png, info.png, failed.png and error.png.
Now, of course, you need to know how to run it!
With Rails 3 you need
With Rails 2 it’s
If you only want to run specs and not features, just take away the
But what about FSEvent?
The normal behaviour for autotest is to constantly poll your filesystem looking for changes. This is wasteful as it will use a lot of CPU and drain your battery, but there is an alternative. From Mac OSX 10.5 onwards an FSEvent service reports modified files.
To make use of FSEvent, you should be able to just install the
autotest-fsevent gem and
require 'autotest/fsevent' in your
Unfortunately, when i tried it, the mere presence of the autotest-fsevent gem seems to cause the specs not to run. It notices changes but doesn’t do anything about them. So if anyone can help me to understand what’s up with that, i would be grateful!
In the mean time, i’m just trying to remember to stop autotest whenever i’ve finished using it.
Despo is well known to us through the Software Craftsmanship User Group, code retreats and other software crafting events. We are looking forward to having Despo join us tomorrow, and we’ve already got plenty of work lined up for Despo to jump straight into (pairing with other edenites, of course!)
Alberto has recently spent a 4 weeks here as an intern, and we are delighted to welcome Alberto back for an apprenticeship with us, starting next week. We have already seen Alberto learn a lot during those 4 weeks, so it will be great to follow Alberto’s further progress.
Both Despo and Alberto have solved the eden minisculus challenge!
I am personally very excited as i shall be acting as a mentor to both of them. This is a new challenge for me, and i’m looking forward to it. I very much enjoyed working with Tom over the summer, and i found that Tom seemed to learn a lot from me by coincidence without me actively trying to teach anything. I think that my skills of empathy and personal development help to make me suitable for the mentorship role.
Welcome, new apprentices, we are all very happy to have you join us! :)