uru is using gems of last installed ruby, regardless what ruby version is active

Issue #112 new
Oscar Segura created an issue

Not sure if this is due to a misconfiguration, but here we go.

When checking the currently active ruby version, it showed 2.6 being used:

C:\ruby_scripts\test>uru list
    2.4.10      : ruby 2.4.10p364 (2020-03-31 revision 67879) [x64-mingw32]
    2.5         : ruby 2.5.7p206 (2019-10-01 revision 67816) [x64-mingw32]
 => 2.6         : ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
    2.7.2       : ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32]

Trying to run a script, an error was thrown:

C:\ruby_scripts\test>ruby main.rb
    31: from C:/ruby_scripts/test/main.rb:19:in `<main>'
    30: from C:/ruby_scripts/test/main.rb:19:in `require_relative'
    29: from C:/ruby_scripts/test/common/run.rb:6:in `<top (required)>'
    28: from C:/ruby_scripts/git/local-gem/lib/gem-name/cli.rb:26:in `run'
    ... 27-14: omitted ...
    15: from C:/ruby_scripts/git/local-gem/lib/gem-name/case.rb:45:in `block in launch'
    14: from C:/ruby_scripts/test/cases/case.rb:13:in `main'
    13: from C:/ruby_scripts/test/cases/case.rb:260:in `element'
    12: from C:/ruby_scripts/git/local-gem2/lib/gem2/api/v2/elements.rb:35:in `get'
    11: from C:/ruby_scripts/git/local-gem3/lib/gem3/api/common/client.rb:59:in `get'
    ... 10-6: omitted ...
     6: from C:/ruby_scripts/git/local-gem3/lib/gem3/api/common/client.rb:119:in `new'
     5: from C:/ruby_scripts/git/local-gem3/lib/gem3/api/common/response.rb:10:in `initialize'
    ... 4-3: omitted ...
     2: from C:/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/http-3.3.0/lib/http/response/body.rb:36:in `each'
     1: from C:/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/http-3.3.0/lib/http/response/body.rb:31:in `readpartial'
C:/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/http-3.3.0/lib/http/response/body.rb:31:in `force_encoding': can't modify frozen String: "" (FrozenError)

Observe the path it jumps to in step 2: C:/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/

Later, I switched uru to ruby 2.7 and updated the http gem to version 4.x. Switched back to ruby 2.6, and running the script did not throw any error.

I thought that uru also manages to switch to the specific gems folder of the ruby version you are using. Isn't that the case?

Comments (1)

  1. Oscar Segura reporter

    well, not quite sure what changed, but after reboot, the above did not happen again

    just wondering how to recreate, but can’t really come up with the steps… perhaps some technical feedback on how the gems folder is scoped by uru could help?

  2. Log in to comment