Skip to content

Commit d17a276

Browse files
Merge pull request #8915 from rubygems/deivid-rodriguez/improve-bundle-show-outdated-deprecation
Fix `bundle show --verbose` and recommend it as an alternative to `bundle show --outdated` (cherry picked from commit a49d940)
1 parent d5a2548 commit d17a276

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

bundler/lib/bundler/cli.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ def update(*gems)
287287
method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated."
288288
def show(gem_name = nil)
289289
if ARGV.include?("--outdated")
290-
message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement"
291-
removed_message = "the `--outdated` flag to `bundle show` was undocumented and has been removed without replacement"
290+
message = "the `--outdated` flag to `bundle show` will be removed in favor of `bundle show --verbose`"
291+
removed_message = "the `--outdated` flag to `bundle show` has been removed in favor of `bundle show --verbose`"
292292
SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
293293
end
294294
require_relative "cli/show"

bundler/lib/bundler/cli/show.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,8 @@ def run
5757

5858
def fetch_latest_specs
5959
definition = Bundler.definition(true)
60-
if options[:outdated]
61-
Bundler.ui.info "Fetching remote specs for outdated check...\n\n"
62-
Bundler.ui.silence { definition.remotely! }
63-
else
64-
definition.with_cache!
65-
end
60+
Bundler.ui.info "Fetching remote specs for outdated check...\n\n"
61+
Bundler.ui.silence { definition.remotely! }
6662
Bundler.reset!
6763
definition.specs
6864
end

bundler/spec/commands/show_spec.rb

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
RSpec.describe "bundle show" do
44
context "with a standard Gemfile" do
55
before :each do
6+
build_repo2
7+
68
install_gemfile <<-G
7-
source "https://gem.repo1"
9+
source "https://gem.repo2"
810
gem "rails"
911
G
1012
end
@@ -86,6 +88,24 @@
8688
\tStatus: Up to date
8789
MSG
8890
end
91+
92+
it "includes up to date status in summary of gems" do
93+
update_repo2 do
94+
build_gem "rails", "3.0.0"
95+
end
96+
97+
bundle "show --verbose"
98+
99+
expect(out).to include <<~MSG
100+
* rails (2.3.2)
101+
\tSummary: This is just a fake gem for testing
102+
\tHomepage: http://example.com
103+
\tStatus: Outdated - 2.3.2 < 3.0.0
104+
MSG
105+
106+
# check lockfile is not accidentally updated
107+
expect(lockfile).to include("actionmailer (2.3.2)")
108+
end
89109
end
90110

91111
context "with a git repo in the Gemfile" do
@@ -219,6 +239,6 @@
219239
end
220240
end
221241

222-
RSpec.describe "bundle show", bundler: "4" do
242+
RSpec.describe "bundle show", bundler: "5" do
223243
pending "shows a friendly error about the command removal"
224244
end

bundler/spec/other/major_deprecation_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@
614614
end
615615

616616
it "prints a deprecation warning informing about its removal" do
617-
expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement")
617+
expect(deprecations).to include("the `--outdated` flag to `bundle show` will be removed in favor of `bundle show --verbose`")
618618
end
619619

620620
pending "fails with a helpful message", bundler: "4"

0 commit comments

Comments
 (0)