Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

will "gem update --system" update rails from 2.3.8 to 3.0?

Tags:

ruby

rubygems

If'n I had a 2nd computer I would just do it and see - but I've finely tuned this thing to not run 3.0 just yet ... don't want to muck it up. Took hours & hours to get here. Bascially - I want to keep rails at 2.3.8 for a while ... so will

gem update --system

update rails from version 2 -> 3? I did read the docs with no clear answer and am guessing it will, but hey, might learn something new. Otherwise I update each one (of the 8 - 1) gems that I have. thanks...

like image 416
rtfminc Avatar asked Sep 08 '10 00:09

rtfminc


People also ask

How do you update a gem to a specific version?

The correct way to update the version of a gem to a specific version is to specify the version you want in your Gemfile, then run bundle install . As for why your command line was failing, there is no -version option.

How do I undo a gem update?

Use git checkout -- Gemfile. lock to revert to your old Gemfile. lock if you've accidentally updated it too.

Where are gems installed rails?

All of your installed gem code will be there, under the gems directory. These paths vary from system to system, and they also depend on how you installed Ruby (rvm is different from Homebrew, which is different from rbenv, and so on). So gem environment will be helpful when you want to know where your gems' code lives.


3 Answers

gem update --system only updates RubyGems.

gem update will update all installed gems to their latest versions, so it will update Rails to 3.0.0.

Before updating the gems you can freeze your application to rails 2.3.8 by executing

rake rails:freeze:gems

in your application folder. Thus your application will be associated and run in rails 2.3.8 environment, even if you update the global gem to rails 3.

You can at any time install a specific rails version via:

gem install rails -v 2.3.8 (or another version of your choice)

This will potentially install multiple gem versions simultaneously, so you can create and develop an app with whichever version you're comfortable with.

Or you can install RVM to create and switch between any number of ruby/rails development environments, e.g. Ruby 1.8.7 with Rails 2.3.9 and ruby 1.9.2 with Rails 3.0.0 and so on.

like image 66
svilenv Avatar answered Oct 16 '22 19:10

svilenv


That command should just update the RubyGems software, not the gems that you have installed.

From command line help:

→ gem help update
Usage: gem update GEMNAME [GEMNAME ...] [options]

  Options:
      --system                     Update the RubyGems system software
like image 6
theIV Avatar answered Oct 16 '22 21:10

theIV


I would recommend you switch your project to use bundler, then you can stop worrying about this. It's easy (and well tested) to do with Rails 2.3.8 and it's designed to solve this problem.

Your next best bet is to install RVM and use gemsets. Alternately, you can check out rip.


(I know this doesn't directly answer your question - I was going to post this as a comment, but with the amount of content I wanted to put it in, my only choice was to provide an answer.)

like image 2
wuputah Avatar answered Oct 16 '22 20:10

wuputah