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 installin a project , if there is noGemfile.lockexist, 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.lockexists, 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 updatedo is Bundler will fetch all remote sources, resolve dependencies and install all needed gems, even though there is aGemfile.lockfile.

You can image bundle update is the same as we remove theGemfile.lock file and run bundle install.

Resource: bundle install

Resource: bundle update

results matching ""

    No results matching ""