postmodern / chruby

Changes the current Ruby
MIT License
2.87k stars 190 forks source link

keep binary compatible gem dir (for ruby 2.1) #272

Open mswart opened 10 years ago

mswart commented 10 years ago

ruby 2.1.* are binary compatible - therefore it is not needed to recompile gems when migrating between these versions. So the gem dir should not be different for these versions.

This patches adjusts the RUBY_VERSION calculation to be 2.1.0 for all 2.1.* ruby versions. This results in constant gem dirs and the same behavior as for rubygems and the GEM_ROOT.

To minimize to risk to break something the adjusted paths are protected by a rescue block and were reexported so that it is ensured that we have an valid RUBY_VERSION value afterwards.

Because the RbConfig::CONFIG['ruby_version'] declared all 1.8.* as binary compatible this value is not used for 1.8 rubies.

I hope this is the best way to adjust chruby.

I did not add any tests, as the setup scripts fails to download ruby 2.0 an ubuntu 14.04 and to really test this change a ruby 2.1.1 or 2.1.2 is needed. Did I miss something?

mswart commented 10 years ago

I overseen #235 as it is looks like a more general solution.