Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is gem still outdated after bundle update

I am working on a gem and it's on github.

When I include the gem in an application, do a capistrano deploy, and (on the server) run:

bundle outdated

I see:

 * authengine (0.0.1 d8baa49 > 0.0.1 de43dfa)

which tells me that a more recent commit is available. Why doesn't the bundle update (part of capistrano deploy) pull the more recent version? There is no version constraint in the Gemfile of the host application, and anyway they have the same version number, just different commits.

Even if I log into the server and run

bundle update authengine

I get the same "outdated" result afterwards.
What am I missing here?

like image 785
Les Nightingill Avatar asked Jun 22 '12 15:06

Les Nightingill


3 Answers

One thing I've found that can cause this is if other gems in the bundle make requirements on gems by version that are incompatible. Bundler tries to reconcile these by selecting versions of gems such that their requirements can all be satisfied. The result is that it quietly refuses to update gems.

The way to check this is to set an explicit version requirement in your Gemfile. Something like

gem "authengine", "> 0.0.2" #(you'll need to bump the version to make this work)
#or
gem "authengine", :ref => "d8baa49"

Then run

bundle update authengine

You should see something like (this is taken from my particular case):

Bundler could not find compatible versions for gem "json": In Gemfile: chef (> 10.8) ruby depends on json (<= 1.6.1, >= 1.4.4) ruby

logical-construct (>= 0) ruby depends on
  json (1.7.5)

So, in my case it's a problem with explicitly requiring a newer version of json.

like image 170
Judson Avatar answered Nov 14 '22 14:11

Judson


The author, André Arko, stated in 2014 that:

The Bundler resolver is definitely a work in progress, and we adjust the tradeoffs between specific versions and resolving quickly based on user feedback.

Bundler has consistently not provided the newest possible version of every gem for the entirety of its existence, and it does result in a lot of tickets being opened. In most cases, it turns out to be the result of Bundler having to pick between the newest version of one gem or a different gem, and Bundler picks the gem the user doesn’t care about having the newest version of. That’s why it’s so important to make your Gemfile version requirements accurately reflect your actual requirements.

I recognize that your assumption that Bundler would give you the newest possible version seemed valid at the time, but the docs only say that you will get a version that meets your requirements, not the latest. Is there anywhere we could expand the docs to make it clearer that the newest versions of everything simply isn’t feasible?

like image 20
Yasushi Shoji Avatar answered Nov 14 '22 12:11

Yasushi Shoji


What is the output returned when you run bundle update authengine? Does it actually say it updated the gem? Or does it ignore the gem?

You can try using the --source parameter to specifically tell Bundler to use the git repository. That, or your

bundle update authengine --source https://github.com/mustardseeddatabase/authengine.git

Also, when unexpected things like this happen, I like to clean up my gemlist in general. It could be that you still have older versions of the gem laying around, not using in bundler.

So you could do:

gem list
gem check
gem cleanup

Or do a complete reinstall

gem uninstall authengine
bundle install
like image 2
JeanMertz Avatar answered Nov 14 '22 13:11

JeanMertz