1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Give a bundle install hint when bundle list fails

https://github.com/rubygems/rubygems/commit/98f5087e34
This commit is contained in:
David Rodríguez 2021-07-26 15:49:28 +02:00 committed by Hiroshi SHIBATA
parent 81c0643762
commit 570167eaa9
Notes: git 2021-08-31 19:07:27 +09:00
2 changed files with 8 additions and 1 deletions

View file

@ -16,7 +16,13 @@ module Bundler
specs = if @only_group.any? || @without_group.any?
filtered_specs_by_groups
else
Bundler.load.specs
begin
Bundler.load.specs
rescue GemNotFound => e
Bundler.ui.error e.message
Bundler.ui.warn "Install missing gems with `bundle install`."
exit 1
end
end.reject {|s| s.name == "bundler" }.sort_by(&:name)
return Bundler.ui.info "No gems in the Gemfile" if specs.empty?

View file

@ -96,6 +96,7 @@ RSpec.context "when using gem before installing" do
bundle :list, :raise_on_error => false
expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in any of the sources")
expect(err).to include("Install missing gems with `bundle install`.")
expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")