If you're looking to update a single gem conservatively, check out this helpful article:
How to update a single gem conservatively
Method 1
This method works when all dependencies for the update are already met.
Determine the version you want to update to
Change it directly in Gemfile.lock
- Run bundle install and verify if it was successful
Method 2
This approach is suitable when the gem has no shared dependencies with other gems.
- Identify the version you wish to update to.
- Add that specific version explicitly to the Gemfile like so:
'=1.2.3'
- Execute
bundle install
- Remove the explicit version number afterward
- Run
bundle install
one more time
Method 3
This method should always deliver results.
- Execute
bundle update GEMNAME
- Check the changes using
git diff Gemfile.lock
and manage any unwanted updates
- Undo undesired changes to
Gemfile.lock
, leaving only the desired updates
- Verify by running
bundle install
Method 4
There have been speculations about updating a single gem via bundle update --source GEMNAME
. However, this feature is not officially documented in Bundler and might be unstable due to potential dependency mismatches.
Exercise caution when using this method and review your Gemfile.lock changes carefully.
Method 5
Bundler >= 1.14
introduces a --conservative flag
. Enabling this flag during bundle update GEM
ensures that only the specified gem gets updated without affecting its dependent gems.
Credits To Author: Henning Koch