Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force the update of a gem with bundler?

Tags:

I have a private git server hosting a gem we developed. The gem got some commits, but the version did not actually change.

How can I force bundler to update my gem even if the version hasn't changed?

I tried "bundler update mygemname" but it did not update anything.

Thanks

like image 288
Dominic Goulet Avatar asked Oct 25 '11 23:10

Dominic Goulet


People also ask

How do you update bundler gems?

As @Tim's answer says, as of Bundler 1.14 the officially-supported way to this is with bundle update --conservative gem-name . Be careful, "updating gem and dependencies" means updating rails itself if it is a dependency and you probably don't want that. --source will only update the gem specified as parameter.

How do I update a specific version of a gem?

The correct way to update the version of a gem to a specific version is to specify the version you want in your Gemfile, then run bundle install . As for why your command line was failing, there is no -version option.

How do you update gems in Ruby on Rails?

Upgrade a Ruby Gem to a Latest Version To upgrade a gem to the latest version, re-install the gem without specifying any version number. Running the above code on my machine upgrades my Rails to v7. To upgrade a gem to the latest version for a Ruby application, run bundle update gem-name .


1 Answers

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.

like image 79
sbeam Avatar answered Oct 24 '22 15:10

sbeam