Search code examples
rubyrspectextmatervm

Rspec bundle is broken in TextMate and rvm


I've had a difficult time since I started using rvm. I've done all the rvm/textmate set up and have the latest bundles but I still can't run Rspec test from textmate.

  • I have the latest bundle from github.com/rspec/rspec-tmbundle.git and it's installed in ~/Library/Application\ Support/TextMate/Bundles/ RSpec.tmbundle

  • RVM default is using the system ruby 1.8.6

  • Rspec gem versions

    gem list --local | grep spec blue_light_special (0.2.0) rspec (2.2.0) rspec-core (2.2.1, 2.0.1) rspec-expectations (2.2.0, 2.0.1) rspec-mocks (2.2.0, 2.0.1) rspec-rails (2.0.1, 1.3.2)

  • TextMate

    TM_RUBY=/Users/jspooner/.rvm/bin/rvm-auto-ruby

  • The Error: rspec/core (LoadError)

    /Users/jspooner/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/rspec/mate.rb:29:in require': no such file to load -- rspec/core (LoadError) from /Users/jspooner/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/rspec/mate.rb:29 from /tmp/textmate-command-8073.rb:2:inrequire' from /tmp/textmate-command-8073.rb:2


Solution

  • The best solution I've found is from Jacques Crocker. http://groups.google.com/group/rubyversionmanager/browse_thread/thread/64b84bbcdf49e9b?fwc=1

    It requires replacing the contents of textmate_ruby with the code below and never running rvm wrapper xxx textmate again.

    #!/usr/bin/env sh 
    source ~/.rvm/scripts/rvm 
    cd . 
    exec ruby "$@" 
    

    This has also fixed the same issue with the cucumber bundle.