rvm friendly TextMate bundles

I forked and modified the Cucumber and RSpec TextMate bundles to setup the rvm environment based on an .rvmrc in your project directory.

Cucumber Bundle

RSpec Bundle

Enjoy. Let me know if you find any quirks.

rvm + gemsets + TextMate == yay! * 2

Ok so in my last post I mentioned I wasn’t able to find a way to automatically use an existing .rvmrc file. I spent some time with it again this afternoon and was able to get it to work. So now if you are using TextMate and you want to run a ruby script that uses your rvm environment all you have to do is edit the commands you use and replace the #! and add a couple lines. The odd thing is this is pretty much exactly what I was trying before, though on a different machine.

#!/usr/bin/env bash

[[ -f "$HOME/.rvm/scripts/rvm" ]] && . $HOME/.rvm/scripts/rvm
[[ -f "$TM_PROJECT_DIRECTORY/.rvmrc" ]] && . $TM_PROJECT_DIRECTORY/.rvmrc

And that’s it, you get your rvm config in TextMate.

rvm + gemsets + TextMate == yay!

So I started playing with rvm a while back and loved the concept of being able to have a gems(et) for each project to completely eliminate gem clashing.

So I now have an .rvmrc in each project directory with the necessary gems installed, no more, no less.

I also have a global gem set that has common gems in it that I use all over the place and aren’t really project specific so I don’t have to install them in every gems(et). Thanks Wayne!

Now, to take it to the next level I wanted to be able to use ⌘+^+R to run the current Cucumber scenario. So I needed to get TextMate aware of my rvm gems(et). This requires setting 3 project specific variables in TextMate.


To get TM_RUBY cd into your project with a .rvmrc in it or set the environment with rvm your_ruby%gemset then run

which ruby

To get GEM_HOME and GEM_PATH run

env | grep GEM

To set these in your project you need to have the project drawer open and nothing selected, then click the “I” button in the bottom corner, then you can add your variables.

I tried to think up a way to have TextMate read the .rvmrc in the project directory, but I wasn’t able to get anything to setup the environment. If anybody has any suggestions I’d love to hear them.

I prefer GemTools over config.gem

So I know I’m obviously biased, but I prefer to use “GemTools”:http://github.com/UnderpantsGnome/gem_tools-gem/tree/master over the gem management feature in Rails. and here’s why.

I can deploy an app to a new server instance and not even need to have rails installed. All I have to do is cap production deploy:setup && cap production deploy and my cap tasks will install the full stack, including Rails.

I can also use “GemTools”:http://github.com/UnderpantsGnome/gem_tools-gem/tree/master without Rails.

I know that I will get the version of my gems that my app expects.

I’ve seen issues with using vendored gems (hpricot I’m looking at you) where even with a frozen gem it will try and include the newest version of the gem installed locally.

Don’t get me wrong, any compiled gems are going to fail in a vendored cross platform environment if the person that vendoerd it was on a different platform.

These are just a couple of the reasons that I prefer to use gemtools install over config.gem

I’m sure I’m in the minority, but that’s ok.

Why Fluid for Mac Rocks

So I tend to work on different projects for different people and it’s nice to be able to sandbox things in their own world.

I know “Fluid”:http://fluidapp.com/ was created as an SSB (Site Specific Browser) and it’s nice for that but for me it’s more of a CSB (Client Specific Browser), I create a Fluid instance for each “client” then I can keep their wiki, issue tracker, time keeping and whatever else I need in a single app.

I find it saves me time and clutter.