Skip to content

Commit 78ef59a

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Refine messages about gem installations being missing
The previous wording was too specific, there may be situations when the gem has actually never installed (so never deleted either). ruby/rubygems@e4a0d71fbe
1 parent 385dc5d commit 78ef59a

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

lib/bundler/cli/info.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def print_gem_path(spec)
3939
path = File.expand_path("../../..", __dir__)
4040
else
4141
path = spec.full_gem_path
42-
if spec.deleted_gem?
43-
return Bundler.ui.warn "The gem #{name} has been deleted. It was installed at: #{path}"
42+
if spec.installation_missing?
43+
return Bundler.ui.warn "The gem #{name} is missing. It should be installed at #{path}, but was not found"
4444
end
4545
end
4646

@@ -65,8 +65,8 @@ def print_gem_info(spec)
6565
gem_info << "\tDefault Gem: yes\n" if spec.respond_to?(:default_gem?) && spec.default_gem?
6666
gem_info << "\tReverse Dependencies: \n\t\t#{gem_dependencies.join("\n\t\t")}" if gem_dependencies.any?
6767

68-
if name != "bundler" && spec.deleted_gem?
69-
return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
68+
if name != "bundler" && spec.installation_missing?
69+
return Bundler.ui.warn "The gem #{name} is missing. Gemspec information is still available though:\n#{gem_info}"
7070
end
7171

7272
Bundler.ui.info gem_info

lib/bundler/cli/show.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def run
2424
return unless spec
2525
path = spec.full_gem_path
2626
unless File.directory?(path)
27-
return Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at: #{path}"
27+
return Bundler.ui.warn "The gem #{gem_name} is missing. It should be installed at #{path}, but was not found"
2828
end
2929
end
3030
return Bundler.ui.info(path)

lib/bundler/rubygems_ext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def nondevelopment_dependencies
258258
dependencies - development_dependencies
259259
end
260260

261-
def deleted_gem?
261+
def installation_missing?
262262
!default_gem? && !File.directory?(full_gem_path)
263263
end
264264

lib/bundler/source/rubygems.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def fetch_gem(spec, previous_spec = nil)
454454
end
455455

456456
def installed?(spec)
457-
installed_specs[spec].any? && !spec.deleted_gem?
457+
installed_specs[spec].any? && !spec.installation_missing?
458458
end
459459

460460
def rubygems_dir

spec/bundler/commands/info_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,33 @@
5656
expect(out).to eq("2.3.2")
5757
end
5858

59-
it "doesn't claim that bundler has been deleted, even if using a custom path without bundler there" do
59+
it "doesn't claim that bundler is missing, even if using a custom path without bundler there" do
6060
bundle "config set --local path vendor/bundle"
6161
bundle "install"
6262
bundle "info bundler"
6363
expect(out).to include("\tPath: #{root}")
64-
expect(err).not_to match(/The gem bundler has been deleted/i)
64+
expect(err).not_to match(/The gem bundler is missing/i)
6565
end
6666

6767
it "complains if gem not in bundle" do
6868
bundle "info missing", raise_on_error: false
6969
expect(err).to eq("Could not find gem 'missing'.")
7070
end
7171

72-
it "warns if path no longer exists on disk" do
72+
it "warns if path does not exist on disk, but specification is there" do
7373
FileUtils.rm_rf(default_bundle_path("gems", "rails-2.3.2"))
7474

7575
bundle "info rails --path"
7676

77-
expect(err).to include("The gem rails has been deleted.")
77+
expect(err).to include("The gem rails is missing.")
7878
expect(err).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
7979

8080
bundle "info rail --path"
81-
expect(err).to include("The gem rails has been deleted.")
81+
expect(err).to include("The gem rails is missing.")
8282
expect(err).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
8383

8484
bundle "info rails"
85-
expect(err).to include("The gem rails has been deleted.")
85+
expect(err).to include("The gem rails is missing.")
8686
expect(err).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
8787
end
8888

spec/bundler/commands/show_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
3636
end
3737

38-
it "warns if path no longer exists on disk" do
38+
it "warns if specification is installed, but path does not exist on disk" do
3939
FileUtils.rm_rf(default_bundle_path("gems", "rails-2.3.2"))
4040

4141
bundle "show rails"
4242

43-
expect(err).to match(/has been deleted/i)
43+
expect(err).to match(/is missing/i)
4444
expect(err).to match(default_bundle_path("gems", "rails-2.3.2").to_s)
4545
end
4646

0 commit comments

Comments
 (0)