chruby icon indicating copy to clipboard operation
chruby copied to clipboard

chruby and .jrubyrc files

Open deivid-rodriguez opened this issue 10 years ago • 6 comments

chruby fails in jruby with a project containing a .jrubyrc file with the cli.load.gemfile=true configuration.

deivid-rodriguez avatar Jul 25 '15 21:07 deivid-rodriguez

Could you provide me with an error message? I'm curious what's breaking when we invoke bin/jruby.

postmodern avatar Dec 24 '15 03:12 postmodern

@postmodern Just tried this and I can no longer reproduce it. Closing.

deivid-rodriguez avatar Dec 24 '15 06:12 deivid-rodriguez

Actually, got it! It happens when switching from another ruby in the apps folder containing the .jrubyrc file.

LoadError: no such file to load -- bundler/setup
  require at org/jruby/RubyKernel.java:939
  require at /Users/deivid/.rubies/jruby-9.0.4.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
    <top> at file:/Users/deivid/.rubies/jruby-9.0.4.0/lib/jruby.jar!/jruby/bundler/startup.rb:4

deivid-rodriguez avatar Dec 24 '15 06:12 deivid-rodriguez

@deivid-rodriguez guessing the exception is happening during jruby startup, and not from the code we pipe into the ruby. Is this a chicken and egg problem, where we need to gem install bundler under jruby, but can't invoke bin/jruby because the lack of bundler? Ideally, jruby should print a warning and keep executing.

postmodern avatar Dec 24 '15 08:12 postmodern

But bundler is installed... After commenting out the .jrubyrc:

$ chruby ruby
$ chruby
 * jruby-9.0.4.0
   ruby-2.0.0-p648
   ruby-2.1.8
   ruby-2.2.4
   ruby-2.3.0-preview2
$ bundle --version
Bundler version 1.11.2

deivid-rodriguez avatar Dec 24 '15 08:12 deivid-rodriguez

That's because when chruby first invokes jruby, GEM_HOME isn't set so jruby can't find bundler.

postmodern avatar Dec 24 '15 10:12 postmodern