How to force the update of a gem with bundler? How to force the update of a gem with bundler? ruby-on-rails ruby-on-rails

How to force the update of a gem with bundler?


you can also put the git hashref right in the Gemfile with the :ref option

gem 'foo', :git => 'git://github.com/foobar/foo.git', :branch => '0.9-beta', :ref => '9af382ed'

especially useful if you don't have control over said gem, and keeps bundler from giving you a newer version in case there are breaking changes.


First of all, don't do that. If you change your gem, you should be updating its version number. Otherwise, it's just confusing.

If you really want to do this, however, you can apply the giant hammer of removing your gem first.

$ gem uninstall foo$ bundle update


that will not work - there is no "force" option - you will have to modify your .gemspec file and increase the version number, then do gem build ..., and bundle install

It is critical for bundler to be able to read the version number from your gem, which was introduced in the .gemspec file. It's confusing not only to bundler or gem update , but also confusing to people if you forget to update the version number in the .gemspec file. They would end up having gem-files lying around, and not be able to tell which versions they are, e.g. which one is newer? (of course you could use md5-sum, but that's beside the point here).

The best thing to do is to correct the mistake in the .gemspec file, and re-release the gem.

Check the bundler source code for available options:

e.g.: bundler-1.0.15/lib/bundler/cli.rb

(search for desc "install")