Bug #11956
closedRUBYOPT parses after rubygems loaded
Description
RUBYOPT=-rloader but loader.rb loads after rubygems.rb loaded
I change GEM_HOME and GEM_PATH in loader.rb , but it doesn't affect Gem.path.
The same loader.rb works at ruby 2.2.3(and before) and jruby.
I uses both MRI ruby and jruby,so I uses RUBYOPT to changes GEM_HOME and GEM_PATH for different ruby engine
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
- Status changed from Open to Feedback
Yes.
And what is your problem?
Updated by personnel (Am I Who) almost 10 years ago
Nobuyoshi Nakada wrote:
Yes.
And what is your problem?
I change GEM_HOME and GEM_PATH in loader.rb , but it doesn't affect Gem.path.
The same loader.rb works at ruby 2.2.3(and before) and jruby.
I uses both MRI ruby and jruby,so I uses RUBYOPT to changes GEM_HOME and GEM_PATH for different ruby engine
Updated by personnel (Am I Who) almost 10 years ago
- Description updated (diff)
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
Rubygems sets Gem.path
at loading the first gem.
Ruby 2.3 bundles did_you_mean
and activates it by default.
Why don't you set GEM_HOME
and GEM_PATH
directly instead of setting them in that file?
Updated by personnel (Am I Who) almost 10 years ago
Nobuyoshi Nakada wrote:
Rubygems sets
Gem.path
at loading the first gem.
Ruby 2.3 bundlesdid_you_mean
and activates it by default.
Why don't you setGEM_HOME
andGEM_PATH
directly instead of setting them in that file?
Because I uses MRI ruby and jruby at the same time, if I just set env variable GEM_HOME and GEM_PATH many gems will conflict within MRI ruby and jruby
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
I'm uncertain if rubygems expects such usage of RUBYOPT
or not.
Another way is to put your code in rubygems/defaults/ruby.rb
under RUBYLIB
.
This file is read only when RUBY_ENGINE
is "ruby"
at initialization of rubygems.
Updated by personnel (Am I Who) almost 10 years ago
Nobuyoshi Nakada wrote:
I'm uncertain if rubygems expects such usage of
RUBYOPT
or not.Another way is to put your code in
rubygems/defaults/ruby.rb
underRUBYLIB
.
This file is read only whenRUBY_ENGINE
is"ruby"
at initialization of rubygems.
RUBYOPT parse prior to rubygems before ruby 2.3.0, why ruby 2.3.0 change this?
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
Am I Who wrote:
RUBYOPT parse prior to rubygems before ruby 2.3.0, why ruby 2.3.0 change this?
I have explained: https://bugs.ruby-lang.org/issues/11956#note-4
Rubygems sets
Gem.path
at loading the first gem.
Ruby 2.3 bundlesdid_you_mean
and activates it by default.
It hasn't changed, just a gem is loaded before RUBYOPT
.
Another way is to set Gem.paths
in that script, instead of setting the environment variables.
Updated by jeremyevans0 (Jeremy Evans) about 6 years ago
- Status changed from Feedback to Closed