Bundle install and bundle update
bundle install
bundle install
_ _is a command we use to install the dependencies specified in your Gemfile.
When we runbundle install
in a project , if there is noGemfile.lock
exist, Bundler will fetch all remote sources, resolve dependencies and install all needed gems.
The way Bundler resolve the dependencies is, Bundler will check the dependencies of each gem, and find out the suitable version of gem for not creating any conflict.
IfGemfile.lock
exists, which means all the versions and dependencies of each gem is recorded. When we update a version of a gem then runbundle install
, only the gem will be updated. But if the dependency of new version of the gem is conflicted with any other gem, the current gem won’t be updated.
Since we didn’t successfully update the gem, so theGemfile.lock
file will remain as the last time it was successfully updated.
bundle update
Whatbundle update
do is Bundler will fetch all remote sources, resolve dependencies and install all needed gems, even though there is aGemfile.lock
file.
You can image bundle update
is the same as we remove theGemfile.lock
file and run bundle install
.
Resource: bundle install
Resource: bundle update