7

I have a Ruby on Rails application and I'm using Ruby Version Manager. Can I update gems using either bundle update or gem update? Are they doing the same thing?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Claudio Floreani
  • 2,441
  • 28
  • 34
  • What is the purpose of asking and answer this question simultaneously? – zeantsoi Nov 26 '13 at 18:17
  • 2
    Please read why it is not merely OK to ask and answer your own question, it is explicitly encouraged here: http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/. That said, you'll notice I haven't accepted the answer yet, because I'm submitting the question to the community to check if it's both complete and correct. – Claudio Floreani Nov 26 '13 at 18:23
  • Question asked at http://stackoverflow.com/questions/4604064/rubygems-bundler-and-rvm-confusion is kinda related to this but really doesn't match the purpose of this question at all. – Claudio Floreani Nov 28 '13 at 17:39

1 Answers1

15

The main difference is that Rubygems (invoked with the command gem) manages all the gems (gemsets if you are using RVM) for a single machine, whereas Bundler (bundle) manages a gem set for a single application (its purpose being to deploy on multiple machines).

The Ruby Version Manager (rvm) only eases the task of managing different gem versions on the same machine, but it's not application-related unless you want to name a gemset for a particular application (see named gemsets).

Both will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources. However Bundler, unlike Rubygems, will only update gems and dependencies specified in the application's Gemfile, complying with its restrictions (version numbers and spermises).

That said, you should use bundle install instead of bundle update, to be sure you are installing the same exact gems and versions across machines.

Claudio Floreani
  • 2,441
  • 28
  • 34
  • 1
    You *should* be using version numbers (or spermies) in your Gemfile to avoid this issue. – Dave Newton Nov 26 '13 at 18:21
  • The command name is Rubygems. The command you use to execute it is `gem`. You might want to fix that, plus, take the time to format the text so it's more readable. – the Tin Man Nov 26 '13 at 18:47