Can bundler show me which gems in Gemfile have newer versions (eg. dry-run of bundle update)
Bundler 1.1 introduced a new 'outdated' feature, which is exactly what I was looking for. Pat Shaughnessy has a great write-up on the new features. In his words, bundle outdated
:
displays the gems it would download and install, but without actually
doing it. This gives me the freedom to inspect the list and update
just the gems I would like to.
This should make it a snap to see what gems are due for an update without actually modifying your source and local gems. Thanks Bundler!
How can you preview the updates that a Bundle Update will make?
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
How can you preview the updates that a Bundle Update will make?
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
Is there a way to get notifications for new gems with Bundler?
According to "Can bundler show me which gems in Gemfile have newer versions (eg. dry-run of bundle update)" topic - there is no direct way to do it.
As a workaround if you use version controll just invoke bundler update
print diff of Gemfile.lock
(against version from repo) and revert it back.
Update Jun 2012: as of bundler 1.1 there is new command option bundle outdated
- it prints nicely what are installed and latest versions of gems:
$ bundle outdated
Fetching gem metadata from http://rubygems.org/.......
Outdated gems included in the bundle:
* multi_json (1.3.6 > 1.1.0)
* activesupport (3.2.6 > 3.2.1)
* activemodel (3.2.6 > 3.2.1)
* journey (1.0.4 > 1.0.3)
...
Thanks Shaun.
What is the best way to uninstall gems from a rails3 project?
Bundler is launched from your app's root directory so it makes sure all needed gems are present to get your app working.If for some reason you no longer need a gem you'll have to run the
gem uninstall gem_name
as you stated above.So every time you run bundler it'll recheck dependencies
EDIT - 24.12.2014
I see that people keep coming to this question I decided to add a little something.
The answer I gave was for the case when you maintain your gems global. Consider using a gem manager such as rbenv or rvm to keep sets of gems scoped to specific projects.
This means that no gems will be installed at a global level and therefore when you remove one from your project's Gemfile and rerun bundle then it, obviously, won't be loaded in your project. Then, you can run bundle clean (with the project dir) and it will remove from the system all those gems that were once installed from your Gemfile (in the same dir) but at this given time are no longer listed there.... long story short - it removes unused gems.
bundle install returns Could not locate Gemfile
You just need to change directories to your app, THEN run bundle install
:)
Related Topics
How to Get My MAChine's Ip Address from Ruby Without Leveraging from Other Ip Address
How to or Should I Find an Object by the Object_Id Attribute in Ruby
Convert Non-Breaking Spaces to Spaces in Ruby
Rails 3.1 with Postgresql: Group by Must Be Used in an Aggregate Function
Could Not Find 'Cocoapods' (>= 0) Among N Total Gem(S) (Gem::Loaderror)
Ruby Invalid Byte Sequence in Utf-8
How to Make Carrierwave Delete the File When Destroying a Record
How to Post Xml to Restful Web Service Using Net::Http::Post
How to Unfreeze an Object in Ruby
Error Installing Debugger: Failed to Build Gem Native Extension with Ruby-1.9.3-P362
Difference Between Kernel#Yield_Self, Yield(Self), Kernel#Then and Object#Tap in Ruby
Is There a Way Rails 3.0.X Can Default to Using Thin
Silencing Deprecation Warnings in Rails 3
Why Is "Wsdl" Namespace Interjected into Action Name When Using Savon for Ruby Soap Communication
Ruby on Rails Advanced JSON Serialization
Bundler Could Not Find Compatible Versions for Gem "Bundler":