Keep RSpec Current

2007-11-15 10:28:25 +0000

I like living on the edge with RSpec. It actually is not so bad. Every week or so I do an update on the trunk, but this is a few steps that should be automated, this is how you do it.

The steps involved are:

  1. Get the latest copy of the RSpec trunk
  2. Build the gem
  3. Install the gem
  4. Install the latest Textmate bundle

This is something perfectly suited to a shell script.

Thanks go to Ashley Moran for giving me the idea to write this blog entry on the RSpec mailing list.

So, this is how I set it up and then do it.

  1. Make a directory where you are going to keep your source tree for RSpec, I keep mine in “Ruby Programs”
  2. baci:~ mikel$ mkdir ruby_programs
    
  3. Then check out the RSpec trunk into this directory
  4. baci:~ mikel$ cd ruby_programs
    baci: mikel$ svn co http://rspec.rubyforge.org/svn/trunk/RSpec
    
  5. Next step is to remove any other version of the RSpec.tmbundle you might have on your computer, you should check the following areas:
  6. ~/Library/Application\ Support/TextMate/Bundles/
    ~/Library/Application\ Support/TextMate/Pristine\ Copy/Bundles/
    /Library/Application\ Support/TextMate/Bundles/
    /Library/Application\ Support/TextMate/Pristine\ Copy/Bundles/
    
  7. Now we have a directory tree, lets make a shell script to handle the work
  8. In your favorite editor, type the following:

    #!/usr/bin/env sh
    cd ~/ruby_programs/rspec/rspec/
    rake clobber
    rake package
    sudo gem install pkg/*.gem
    

    As a note, prefixing a path with ”~” is shorthand to insert the path to your home directory, which in my case is /Users/mikel/

  9. You can save the above code in your home directory, call it RSpec_update.sh, you also need to make it executable by doing the following:
  10. chmod 775 ~/RSpec_update.sh
    
  11. Now run the command, watch the text fly by, enter your password where needed and you would have updated your RSpec bundle, gem and docs all in one swoop!

Enjoy!

blogLater

Mikel