views:

166

answers:

1

What should I do before upgrading to the latest version of Ruby? any tips?

Update

sorry for my unclear question.

my condition: I've upgraded my Ruby from 1.8.7 to 1.9.1p243. It makes me can not use all installed gems.

so, what should I do before upgrading Ruby? uninstall all my installed gems? I was looking in other SO posts in here, But there are no answers for my question.

+1  A: 

Unless you are using custom GEM environment variables or a .gemrc (or some multi ruby system like rvm) then the locations where rubygems are installed for each ruby installation will be different.

You can manage the locations used by rubygems by managing the GEM_HOME and GEM_PATH environment variables or the .gemrc file. It is possible to set your gems to be shared across ruby installations with these variables or the .gemrc

.gemrc: http://docs.rubygems.org/read/chapter/11

GEM Environment variables: http://docs.rubygems.org/read/chapter/12#page52

You can find the environment settings for a rubygems installation by running:

/path/to/gem env

This will output something like the following:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.4
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]
  - INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /opt/local/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /opt/local/lib/ruby/gems/1.8
     - /home/aji/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org/", "http://gemcutter.org"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gemcutter.org

While the number of rubygems that are compatible with ruby 1.9 is constantly growing, you will need to check with the maintainer or homepage of each gem/project to verify if your gems will work or not.

Also check previous questions on SO regarding differences between 1.8 & 1.9: http://stackoverflow.com/questions/21574/what-is-the-difference-between-ruby-1-8-and-ruby-1-9

Mark Carey
thx Mark..really helpful.
kuntoaji