How to re-sync Gemfile.lock on changes to Gemfile.
Assuming I have 3 gems (gem1, gem2, gem3) in the Gemfile.
bundle install
creates a Gemfile.lock file.
If I remove gem3 and run bundle install
, I would like Gemfile.lock to be re-generated and gem3 removed from the rvm gemset. But it doesn't, how should I re-sync without dropping the gemset.
Gemfile. lock is automatically generated when you run bundle install or bundle update . It should never be edited manually.
The Gemfile is where you specify which gems you want to use, and lets you specify which versions. The Gemfile. lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.
The Gem Development guide says that the Gemfile. lock file "should always be checked into version control." However, this is NOT true for Gems. For Applications, like your Rails apps, Sinatra apps, etc., it is true. The same does not go for Gems.
To bring the Gemfile.lock in line with Gemfile edits, run bundle check
.
To bring the Gemfile.lock in line with both the Gemfile edits AND the latest compatible gems, run bundle update
.
Related: This blogpost by viget has some good advice on Bundler Best Practices
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With