Both can install gems that are specified in Gemfile, however bundle update would also update the gems to the latest version, if no version is specified in Gemfile, or will update it to the latest patch version (i.e. ~> 1.2.3 will update to the newest version of 1.2.x, it might be 1.2.4, 1.2.5, etc)
Bundle install on the other hand, would install the latest patch version of the gem if the gem is missing from the Gemfile, but won't do anything if it is already present.
So... bundle update might surprise you if something changed between patch version or make the gem incompatible with some other gem, hence caution must be taken with bundle install command.
And as a best practice, always specify versions in the Gemfile!
No comments:
Post a Comment