Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "bundle update" and "gem update"? [duplicate]

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?

like image 852
Claudio Floreani Avatar asked Nov 26 '13 18:11

Claudio Floreani


1 Answers

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.

like image 52
Claudio Floreani Avatar answered Sep 30 '22 17:09

Claudio Floreani