[前][次][番号順一覧][スレッド一覧]

ruby-changes:67399

From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:06:45 +0900 (JST)
Subject: [ruby-changes:67399] 570167eaa9 (master): [rubygems/rubygems] Give a `bundle install` hint when `bundle list` fails

https://git.ruby-lang.org/ruby.git/commit/?id=570167eaa9

From 570167eaa9084cec3b11fd3eca64955795835283 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Mon, 26 Jul 2021 15:49:28 +0200
Subject: [rubygems/rubygems] Give a `bundle install` hint when `bundle list`
 fails

https://github.com/rubygems/rubygems/commit/98f5087e34
---
 lib/bundler/cli/list.rb             | 8 +++++++-
 spec/bundler/install/yanked_spec.rb | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/bundler/cli/list.rb b/lib/bundler/cli/list.rb
index 66abd32..f56bf5b 100644
--- a/lib/bundler/cli/list.rb
+++ b/lib/bundler/cli/list.rb
@@ -16,7 +16,13 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/list.rb#L16
       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?
diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb
index b45a74c..c5f3d78 100644
--- a/spec/bundler/install/yanked_spec.rb
+++ b/spec/bundler/install/yanked_spec.rb
@@ -96,6 +96,7 @@ RSpec.context "when using gem before installing" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/yanked_spec.rb#L96
     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.")
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]