Peter Nixey
Peter Nixey

Reputation: 16565

How can you preview the updates that a "Bundle Update" will make?

Sometimes I want to run bundle update but only to see which gems need updating. I don't necessarily want to deal with the issues associated with updating all of them but I want to do a quick check to see what's the state of the art.

Is there a way to simply get Bundler to list the gems that need to be updated together (ideally) with the version I'm currently running and what's the latest and greatest?

Upvotes: 7

Views: 2274

Answers (5)

noraj
noraj

Reputation: 4642

List installed gems with newer versions available:

bundle outdated

Only list gems specified in your Gemfile, not their dependencies.

bundle outdated --only-explicit

Upvotes: 0

tozlu
tozlu

Reputation: 4865

Since google searches hit this page and the answers provided have some points that needs attention, i will add another answer.

If you want to see which updates are released for your gems, taking "version dependency requirements in your Gemfile" into account, use:

bundle outdated --strict  

If you don't want to take version dependency into account, simply use bundle outdated as specified in other answers.

Secondly, if you want to update a specific gem, use:

bundle update --source gemname

bundle update gemname updates the gem and all its dependencies which may leave you in a mess (even rails gets updated by using bundle update haml).

Upvotes: 6

Ryan
Ryan

Reputation: 9430

There is now a way to do this directly with bundler. You do not need to install any extra gems.

bundle outdated

will return something like this

Outdated gems included in the bundle:
  * acts-as-taggable-on (2.4.1 > 2.3.3)
  * addressable (2.3.4 > 2.3.3)
  * arel (4.0.0 > 3.0.2)
  * better_errors (0.8.0 > 0.7.2)
  * builder (3.2.0 > 3.0.4)
  * capybara (2.1.0 > 2.0.3)
  * chunky_png (1.2.8 > 1.2.7)
  * codemirror-rails (3.12 > 3.02)
  * coffee-rails (4.0.0 > 3.2.2)
  .....

Upvotes: 16

dexter
dexter

Reputation: 13593

I tried this:

> gem install bundle_outdated
> bundle-outdated
Finding outdated gems..

Newer versions found for:
  rails (3.1.0 > 3.0.0)
  haml (3.1.2 > 3.0.0)
  rspec-rails (2.6.1 > 2.0.1)

Lock bundle to these versions by putting the following in your Gemfile:
  gem 'rails', '3.1.0'
  gem 'haml', '3.1.2'
  gem 'rspec-rails', '2.6.1'

You may try to update non-specific dependencies via:
  $ bundle update haml rspec-rails

Handwaving specifications:
  haml: >= 3.0.0
  rspec-rails: >= 2.0.1

Another alternative:

> gem install gem-outdated
> gem outdated

Upvotes: 4

Chris Bailey
Chris Bailey

Reputation: 4136

There's not a way to do this directly with bundler, but so long as you're using a VCS then you can always revert the Gemfile.lock to revert the changes make by update, or diff the file to see what changes have been made. See this similar question

Upvotes: 0

Related Questions