The difference between $ Bundle install and $ Bundle update

Could you tell me what is the difference between:

$Bundle update 

and

 $Bundle install 
+47
ruby-on-rails
May 11 '13 at 9:20
source share
2 answers

bundle update and bundle install can all install gems that you specify in the Gemfile but are missing from the gems.

But bundle update does another update:

  • If the gems specified in the Gemfile do not have a version, it will be updated to any last.
  • If the gems specified in the Gemfile have a version with ~> , it will be updated to the last in the last digit , version of the patch.

    For example, if you have a gem in a gemfile

     'foo_gem', '~> 2.1.0' 

    bundle update checks if a newer version 2.1.x is available in the cloud. Say your current version is 2.1.2, and the latest in the cloud is 2.1.5, it will install 2.1.5. But if 2.2.6 is the newest, it will not do anything.

Best practice in my opinion

  • Always add a version to critical stones like rails .

  • In most cases, stick with bundle install (or bundle , which is install by default). Perform bundle update only when it is really necessary, and you are fully prepared for the result.

+62
May 11 '13 at 11:08
source share

Bundle Update preset gems (all gems, if not specified), ignoring previously installed gems specified in Gemfile.lock. In general, you should use bundle install to install the same exact gems and versions on machines.

+5
May 11 '13 at 9:32
source share



All Articles