Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textmate Rails3 no such file to load — bundler

When I try to run tests from TextMate in Rails3 i get an error that I trace back to boot.rb. When I try to run boot.rb via textmate I get this error:

LoadError: no such file to load — bundler

method gem_original_require in custom_require.rb at line 31
method require  in custom_require.rb at line 31
at top level    in boot.rb at line 4

This is even in a brand new rails project. I am able to run the same boot.rb file from terminal calling

ruby <path_to>/boot.rb

I can verify that my TM_RUBY variable is the same as when i call which ruby from the command line. Do you have any clue why I might be getting this error?

like image 799
Schneems Avatar asked Sep 07 '10 23:09

Schneems


3 Answers

I ran into this same problem with TextMate and RVM. What you need to do:

  1. Create a wrapper script for the gemset you want to use, using this RVM command:

    rvm wrapper ree@rails3 textmate
    

    This will add a new alias to your RVM install called textmate_ruby. As you can probably tell this assumes you're using Ruby Enterprise (ree) and a gemset called rails3, but any RVM string will work here.

  2. Open TextMate's preferences window, go to Advanced > Shell Variables. You need to create (or update) the TM_RUBY shell variable to the following:

    /path/to/your/.rvm/bin/textmate_ruby
    

    If your RVM is installed in your user dir (like mine), that'll be:

    /Users/[YOUR USER NAME HERE]/.rvm/bin/textmate_ruby
    
  3. (Optional) You may also need/want to set the RUBYOPT shell variable, to instruct Ruby to load rubygems. This may be necessary to make certain bundles (like RSpec) work. Just set the value to rubygems.

This should be all you need.

like image 63
David Demaree Avatar answered Nov 10 '22 03:11

David Demaree


I found it was simplest to use the rvm-auto-ruby approach.

Locate the rvm-auto-ruby binary using which:

$ which rvm-auto-ruby

The result is the path to the auto-loading binary:

/Users/yourusername/.rvm/bin/rvm-auto-ruby

Add this path to TextMate under: Preferences -> Advanced -> Shell Variables

It functions like an alias that points to your active version of Ruby.

Screenshot: http://cl.ly/23Yl

These instructions are available on the RVM website: https://rvm.io/integration/textmate/

like image 3
mattlondon Avatar answered Nov 10 '22 03:11

mattlondon


To get TextMate to use the same RVM Ruby interpreter as the command line, I did the following:

  • On the command line, typed which ruby - for me, this was /Users/mgp/.rvm/gems/ruby-1.9.2-p180/bin/ruby
  • In TextMate preferences, i added /Users/mgp/.rvm/gems/ruby-1.9.2-p180/bin to the front of my PATH shell variable.
  • In TextMate preferences, i added a new shell variable GEM_PATH with the value /Users/mgp/.rvm/gems/ruby-1.9.2-p180:/Users/mgp/.rvm/gems/ruby-1.9.2-p180@global
like image 1
mgp Avatar answered Nov 10 '22 04:11

mgp