Rubymine and Isolate
My company uses Isolate (http://github.com/jbarnette/isolate) for managing Gems in our project. Isolate has similar but much more scaled back goals to Bundler and is really simple and easy to understand. It does 2 things: install gems from an Isolate file to a folder inside your project and then isolate your project from your system gems (not always though). It does this through changing (primarily) GEM_HOME.
Here's my rvm info when not in isolation:
environment:
PATH: "/Users/bjclark/.rvm/bin:/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global/bin:/Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/bin:/Users/bjclark/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/bjclark/dev/narwhal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin"
GEM_HOME: "/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global"
GEM_PATH: "/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global:/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global"
BUNDLE_PATH: "/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global"
MY_RUBY_HOME: "/Users/bjclark/.rvm/rubies/ruby-1.8.7-p249"
IRBRC: "/Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/.irbrc"
RUBYOPT: ""
gemset: "global"
And when I use isolate (this is just `rvm info` inside a `rake isolate:sh`), it looks like this:
environment:
PATH: "/Users/bjclark/.rvm/bin:/Users/bjclark/Development/project/tmp/isolate/ruby-1.8/bin:/Users/bjclark/.rvm/bin:/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@blank/bin:/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global/bin:/Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/bjclark/dev/narwhal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin"
GEM_HOME: "/Users/bjclark/Development/project/tmp/isolate/ruby-1.8"
GEM_PATH: "/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@blank:/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global"
BUNDLE_PATH: "/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@blank"
MY_RUBY_HOME: "/Users/bjclark/.rvm/rubies/ruby-1.8.7-p249"
IRBRC: "/Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/.irbrc"
RUBYOPT: ""
gemset: ""
Now, Rubymine already parses my Isolate file fine, and requires the necessary gems, I get attachments, etc. And if I set up a new rake task that just runs "spec" and I set up GEM_HOME properly, it will run the specs fine.
However, if I attach the test runner UI for rspec, I get this error:
/Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/bin/rake spec
Testing started at 7:44 PM ...
(in /Users/bjclark/Development/project)
/Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global/gems/isolate-2.1.1/lib/isolate/rake.rb:1: undefined method `namespace' for main:Object (NoMethodError)
from /Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/bjclark/.rvm/gems/ruby-1.8.7-p249@global/gems/isolate-2.1.1/lib/isolate/now.rb:2
from /Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /Users/bjclark/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
So, obviously, in a rake task, there should be a method called namespace. Anyone know what's going on here? I'm a really big fan of Rubymine, but this has stopped me from using it on a daily basis, and that's too bad. Is there anything I can do? I filed a ticket in youtrack months ago. . . :(
请先登录再写评论。
It works in my case.
I've tried to create a minimal reproducing scenario.
1. I created empty gemset ruby-1.8.7-p302@isolate and set it as RubyMine sdk
2. Created project with 3 files:
In my case spec rake task works ok from RubyMine and shows Test Runner GUI. By the way I didn't override GEM_HOME, seems it isn't necessary because "require 'isolate/now" does it on runtime
P.S: By default "spec" task doesn't work in rspec 2.0, see workaround in http://github.com/rspec/rspec-core/issues#issue/129 bug request