0
votes

I use RVM and have some legacy projects where I use Ruby 1.8.7, rails 2.3.x, rspec 1.3.0 and rspec-rails 1.3.2. But after installing Ruby 1.9.2 and some gems rvm is messing up the Gem paths for 1.9.2 and my 1.8.7 gemset:

When I run my specs with rake I get the following error:

"\"/home/vermelho/.rvm/gems/ruby-1.8.7-p302@rails2/gems/paperclip-2.3.3/data/paperclip\""
config.load_paths is deprecated and removed in Rails 3, please use autoload_paths instead
config.load_paths= is deprecated and removed in Rails 3, please use autoload_paths= instead
Exception encountered: #<OptionParser::InvalidOption: --loadby>
backtrace:
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/option_parser.rb:18:in `parse!'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/option_parser.rb:4:in `parse!'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/configuration_options.rb:64:in `parse_command_line_options'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/configuration_options.rb:46:in `parse_options'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:7:in `initialize'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/monkey/spork/test_framework/rspec.rb:4:in `new'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/monkey/spork/test_framework/rspec.rb:4:in `run_tests'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:13:in `block in run'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/forker.rb:21:in `block in initialize'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/forker.rb:18:in `fork'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/forker.rb:18:in `initialize'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:in `new'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:in `run'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/server.rb:47:in `run'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'

In the gemset I currently use rspec 2 is not installed, and my current ruby installation and gemset should know nothing about gems from another ruby installation, right?

2

2 Answers

2
votes

I just ran into the same problem. The answer is that spork is running using another version of ruby, likely for another ruby application. Rspec tries to connect to spork if using the --drb option. Spork uses the version of rspec it already has loaded. Easy solution, stop the other spork process before trying to run rspec.

I do not believe that this problem has anything to do with RVM.

1
votes

I've never seen RVM do that so I suspect something was preexisting then RVM was loaded into the system. Was Ruby 1.8.7 a system-install or were some of the gems loaded outside of RVM? If so RVM can't really do much to corral the pre-existing configurations.

The only other thing I can think of is that Rails captured the paths to the gems, then you installed RVM. I did my Rails installs under RVM, then converted to Rails 3 and upgraded my projects with everything under RVM control and didn't see what you are.

You might need to ask Wayne Seguin (wayneeseguin in #rvm on irc.freenode.net) for some help. I'm pretty sure he'll ask what version of RVM you're on so have the output of rvm -v ready. The current rev as of right now is:

rvm -v
rvm 1.0.21 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]