Why Are We Installing Ruby 1.9.2/1.9.3 Gems into a 1.9.1 Folder

Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?

In Ruby 1.9.0, the C interface was changed from the Ruby 1.8 series.

Gems that compile to native code had to be recompiled.

The interface was again changed in Ruby 1.9.1 and kept the same in Ruby 1.9.2 & 3. This explains the 1.9.1 you are seeing in your path.

The idea is that you can install different versions of Ruby on your system and that gems would be shared within groups having the same C api. So Ruby 1.8.6 and 1.8.7 could share their gems, and so could Ruby 1.9.1, .2 and .3.

It's not necessarily the best idea, though. In any case, most people use rvm to access different versions of Ruby and rvm keeps gems separate for each version, irrespective of the C api version.

Why are gems installed into a 1.9.1. directory even though I have 1.9.3 installed?

In chef, you can find the directory where rubygems creates executables in in node["languages"]["ruby"]["bin_dir"]. You should thus never hardcode these paths in your recipes as they can change.

As for your exact question: In Ruby >= 1.9.1 and < 2.0.0, rubygems installs gems into a 1.9.1 directory to denote its usage of the 1.9.1 ABI. The intention was that gems compiled against that can be used interchangeably between different ruby versions using this ABI. However, in practice this turned out to be more difficult...

Ruby 2.0.0 uses the 2.0.0 directory. Again, you should not hardcode the paths but use the node attribute (set by OHAI using rubygem's own facilities).

Why Do Heroku Stack Traces indicate Ruby 1.9.1 is in use?

It's not actually using Ruby 1.9.1 -- as this answer from Marc-André Lafortune explains, it has to do with the C interface, which hasn't changed since Ruby 1.9.1.

In Ruby 1.9.0, the C interface was changed from the Ruby 1.8 series.

Gems that compile to native code had to be recompiled.

The interface was again changed in Ruby 1.9.1 and kept the same in Ruby 1.9.2 & 3. This explains the 1.9.1 you are seeing in your path.

The idea is that you can install different versions of Ruby on your system and that gems would be shared within groups having the same C api. So Ruby 1.8.6 and 1.8.7 could share their gems, and so could Ruby 1.9.1, .2 and .3.

It's not necessarily the best idea, though. In any case, most people use rvm to access different versions of Ruby and rvm keeps gems separate for each version, irrespective of the C api version.

How to specify the Ruby version for a Heroku worker (eg. sidekiq)?

Nothing to worry about. Bundler stores the gems in 1.9.1 for ruby 1.9.3. For more info, see here: Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?

Does Ruby 1.9.3 use the Ruby 1.91. network stack? Or did RVM mess me up?

I got bitten by this recently: apparently, because the standard library didn't change, they didn't raise the version. I got the 1.9.3 vs 1.9.2 from Debian packages, but understand it covers the whole thing.

Ruby bundle creating a self contained package

Gems installed under 1.9.3 go into a 1.9.1 directory because they have the same compatibility version. This is normal Ruby Gems behavior, see Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?

All of your gems should be installed into the bundle/ruby/1.9.1 directory. Do you see them in there?

To run on a server without bundler installed, you'll need to generate the tarball using bundle install --standalone.

This creates a file at bundle/bundler/setup.rb that you can require from config/boot.rb instead of requiring bundler/setup.

See: http://myronmars.to/n/dev-blog/2012/03/faster-test-boot-times-with-bundler-standalone

rbenv, ruby 1.9.3-p237 and jekyll

Found the issue. Seems like psych is double loaded, one time by gem, other by stdlib. So, i just removed the gem:

 gem uninstall psych 

And now it's working.

Anyway, here, take some related links:

  • https://github.com/rails/rails/issues/6520
  • https://github.com/CS169-Raxa/raxa-visualizations/issues/51
  • https://github.com/rails/rails/issues/3488
  • https://gist.github.com/3079083
  • https://github.com/carlhuda/bundler/issues/2068
  • https://github.com/tenderlove/psych/issues/66

There's also a solution that say's to add the psych gem to application Gemfile. Weird.



Related Topics



Leave a reply



Submit