Project

General

Profile

Bug #11956

RUBYOPT parses after rubygems loaded

Added by personnel (Am I Who) almost 4 years ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
[ruby-core:72726]

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

History

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Status changed from Open to Feedback

Yes.

And what is your problem?

Updated by personnel (Am I Who) almost 4 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 4 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) almost 4 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 4 years ago

Nobuyoshi Nakada wrote:

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?

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 4 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 4 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 under RUBYLIB.
This file is read only when RUBY_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 4 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 bundles did_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.

#9

Updated by jeremyevans0 (Jeremy Evans) 3 months ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF