no such file to load — .bundle/environment (LoadError)

First published on Fencore Ltd.’s Posterous page on October 13th, 2010

As part of the confusion I caused for myself last week (see https://martinjhawkins.wordpress.com/2013/10/08/installing-ri-documentation-for-rails-3-0-0-file-not-found-lib-and-rvm), I managed to include a fight with Textmate.
I use Cucumber and I run the features from within Textmate; for me the information is presented far better than it is on the command line.
After I’d installed rvm and re-installed the gems, using Bundler, I proceeded to check that testing was working as it had been. So, I loaded everything into Textmate, opened a feature window and hit Command-r. Instead of the results window I got an error trace, in which was the following: ‘no such file to load -- .bundle/environment (LoadError)‘.
So – off to look at the .bundle folder – no sign of an environment.rb file. Look at the Bundler web site – nothing there. Google the error – yes, some other people have seen it but there don’t seem to be any magic fixes.
Off to the rvm site again; check that rvm is installed properly – yes; check that all the actions mentioned under Integration/Textmate have been completed yes. I’m beginning to get that horrible sinking feeling that I’ve broken something serious.
On a whim, I created an empty .bundle/environment.rb file and tried to run the feature again – and lo – it worked! I have no idea what this file actually does in the grand scheme of things but the unfortunate thing was that it got deleted every time I ran a feature test. I was not going to recreate it every time.
Time for a re-install.
Cucumber.tmbundle‘ lives in the ~/Library/ApplicationSupport/TextMate/Bundles/ folder, so I deleted it and re-installed it using the instructions on the ‘http://github.com/drnic/cucumber-tmbundle‘ page. Re-loaded Bundles in Textmate and now nothing worked. The only thing that showed up in the Cucumber bundle now was ‘Switch to new Canonical Fork’. Eh? That wasn’t there before and was certainly not what I wanted.
Cue an even deeper sinking feeling.
I took a careful look at what I’d done. I’d copied the instructions from http://github.com/drnic/cucumber-tmbundle without paying too much close attention and realised that was the error.
Drnic has taken over the development of the Cucumber.tmbundle from Ben Mabey, who created it but who no longer used it. Rather than let it whither and die he passed it across to Drnic. In cloning the site, a basic error was made – the important line in the instructions refer to the old site. In order to make the install work properly, you need to replace the line that says

git clone git://github.com/bmabey/cucumber-tmbundle.git Cucumber.tmbundle

with

git clone http://github.com/drnic/cucumber-tmbundle.git Cucumber.tmbundle

Once I’d realised that mistake, I re-installed and everything worked fine.