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?
I ran into this same problem with TextMate and RVM. What you need to do:
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.
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
(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.
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/
To get TextMate to use the same RVM Ruby interpreter as the command line, I did the following:
which ruby - for me, this was /Users/mgp/.rvm/gems/ruby-1.9.2-p180/bin/ruby
/Users/mgp/.rvm/gems/ruby-1.9.2-p180/bin to the front of my PATH 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With