Bundler picking up wrong version of Ruby with Rails 3 ( possible bundler bug )

Hello All,

I am developing a JRuby on Rails 3 application. Standard stuff.

I am facing problems getting autotest to run.

Here’s the trace:

% autotest
loading autotest/rails_rspec2
bundle exec
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.22/bin/rspec
‘/Users/manish/Foo/Foo-Server/FooInsight/spec/controllers/users_controller_spec.rb’
‘/Users/manish/Foo/Foo-Server/FooInsight/spec/helpers/home_helper_spec.rb’
‘/Users/manish/Foo/Foo-Server/FooInsight/spec/helpers/install_helper_spec.rb’
‘/Users/manish/Foo/Foo-Server/FooInsight/spec/models/user_spec.rb’
*
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52
*:in initialize': Valid types are [:development, :runtime], not nil (ArgumentError) from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:355:in new’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:355:in
search' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:181:in resolve’
from
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/source_index.rb:95:in
sort_by' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:177:in each’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:177:in
sort_by' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:177:in resolve’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:162:in
start' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:131:in resolve’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:130:in
catch' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:130:in resolve’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:153:in
resolve' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:93:in specs’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:137:in
specs_for' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:126:in requested_specs’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/environment.rb:23:in
requested_specs' from /Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:11:in setup’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler.rb:100:in
`setup’
from
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/setup.rb:6

This is my PATH →
/Users/manish/Foo/Twist-Server/jruby-1.5.2/bin:/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

As you can see that ruby is picked up from *
/System/Library/Frameworks/Ruby.Framework* instead of *
/Users/manish/Foo/Twist-Server/jruby-1.5.2/bin* which is ahead in the
PATH.

I am on Snow Leopard 10.6.4 with jruby 1.5.2 (ruby 1.8.7 patchlevel 249)
(2010-08-20 1c5e29d) (Java HotSpot™ 64-Bit Server VM 1.6.0_20)
[x86_64-java]

Is this a bug? Any pointers?


Best,
Manish Chakravarty
twitter.com/ManishChaks

On Wed, Sep 22, 2010 at 4:51 AM, Manish Chakravarty
[email protected]wrote:

bundle exec
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/resolver.rb:355:in
from
`start’
/Users/manish/Foo/Foo-Server/jruby-1.5.2/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:153:in
from

(2010-08-20 1c5e29d) (Java HotSpot™ 64-Bit Server VM 1.6.0_20)
Best,
Manish Chakravarty

It looks like autotest is executing with a different environment than
yours.
Does it run as a different user (su, maybe), or as a cron job? Either of
those would be using a different environment. Try % env PATH=$PATH
autotest

Adam S.