Skip to content

Commit

Permalink
Give a bundle install hint when bundle list fails
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jul 26, 2021
1 parent c24415f commit 98f5087
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bundler/lib/bundler/cli/list.rb
Expand Up @@ -16,7 +16,13 @@ def run
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?
Expand Down
1 change: 1 addition & 0 deletions bundler/spec/install/yanked_spec.rb
Expand Up @@ -96,6 +96,7 @@
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.")
Expand Down

0 comments on commit 98f5087

Please sign in to comment.