summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-30 11:36:43 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-05 09:26:25 +0200
commit698b247ed83a0f03e86c6d6954c380b9eeab8060 (patch)
tree3b5ab8d056c205d23cc9bbea7f9258216c6bc788
parent782bd183a538fa1d2994473ee0461804bc9e48bb (diff)
downloadbundler-698b247ed83a0f03e86c6d6954c380b9eeab8060.tar.gz
Remove `bundle show` from bundler 3
-rw-r--r--lib/bundler/cli.rb55
-rw-r--r--spec/commands/show_spec.rb2
2 files changed, 29 insertions, 28 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 3dc90c04dc..d11172ed44 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -282,35 +282,38 @@ module Bundler
end
end
- desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
- long_desc <<-D
- Show lists the names and versions of all gems that are required by your Gemfile.
- Calling show with [GEM] will list the exact location of that gem on your machine.
- D
- method_option "paths", :type => :boolean,
- :banner => "List the paths of all gems that are required by your Gemfile."
- method_option "outdated", :type => :boolean,
- :banner => "Show verbose output including whether gems are outdated."
- def show(gem_name = nil)
- if ARGV[0] == "show"
- rest = ARGV[1..-1]
-
- new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
-
- new_arguments = rest.map do |arg|
- next arg if arg != "--paths"
- next "--path" if new_command == "info"
- end
+ unless Bundler.feature_flag.list_command?
+ desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
+ long_desc <<-D
+ Show lists the names and versions of all gems that are required by your Gemfile.
+ Calling show with [GEM] will list the exact location of that gem on your machine.
+ D
+ method_option "paths", :type => :boolean,
+ :banner => "List the paths of all gems that are required by your Gemfile."
+ method_option "outdated", :type => :boolean,
+ :banner => "Show verbose output including whether gems are outdated."
+ def show(gem_name = nil)
+ if ARGV[0] == "show"
+ rest = ARGV[1..-1]
+
+ new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
- old_argv = ARGV.join(" ")
- new_argv = [new_command, *new_arguments.compact].join(" ")
+ new_arguments = rest.map do |arg|
+ next arg if arg != "--paths"
+ next "--path" if new_command == "info"
+ end
- Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
+ old_argv = ARGV.join(" ")
+ new_argv = [new_command, *new_arguments.compact].join(" ")
+
+ Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
+ end
+ require "bundler/cli/show"
+ Show.new(options, gem_name).run
end
- require "bundler/cli/show"
- Show.new(options, gem_name).run
+
+ map %w[list] => "show"
end
- # TODO: 2.0 remove `bundle show`
if Bundler.feature_flag.list_command?
desc "list", "List all gems in the bundle"
@@ -324,8 +327,6 @@ module Bundler
end
map %w[ls] => "list"
- else
- map %w[list] => "show"
end
desc "info GEM [OPTIONS]", "Show information for the given gem"
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index d79ac2704f..6634a3f7ed 100644
--- a/spec/commands/show_spec.rb
+++ b/spec/commands/show_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle show" do
+RSpec.describe "bundle show", :bundler => "< 3" do
context "with a standard Gemfile" do
before :each do
install_gemfile <<-G