summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEdouard CHIN <chin.edouard@gmail.com>2025-04-04 00:45:06 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-04-22 11:27:23 +0900
commitc2e58a90435e506fde3ca055dc9eb3faa2ed6412 (patch)
treeb0f83e94ca25df4506ff38425445dacae6677eec /lib
parentef82273c04c8d0b8f858d6fdbcc50155ad9921f9 (diff)
[rubygems/rubygems] Define `bundler doctor` as a subcommand
- See explanation in previous commit https://github.com/rubygems/rubygems/commit/170890befb4c https://github.com/rubygems/rubygems/commit/8f1b5a4479
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb13
-rw-r--r--lib/bundler/cli/doctor.rb20
-rw-r--r--lib/bundler/cli/doctor/diagnose.rb2
-rw-r--r--lib/bundler/cli/issue.rb4
4 files changed, 25 insertions, 14 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 91c31651da..51f71af501 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -610,17 +610,8 @@ module Bundler
end
desc "doctor [OPTIONS]", "Checks the bundle for common problems"
- long_desc <<-D
- Doctor scans the OS dependencies of each of the gems requested in the Gemfile. If
- missing dependencies are detected, Bundler prints them and exits status 1.
- Otherwise, Bundler prints a success message and exits with a status of 0.
- D
- method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
- method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
- def doctor
- require_relative "cli/doctor"
- Doctor.new(options).run
- end
+ require_relative "cli/doctor"
+ subcommand("doctor", Doctor)
desc "issue", "Learn how to report an issue in Bundler"
def issue
diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb
new file mode 100644
index 0000000000..21437fc89f
--- /dev/null
+++ b/lib/bundler/cli/doctor.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+module Bundler
+ class CLI::Doctor < Thor
+ default_command(:diagnose)
+
+ desc "diagnose [OPTIONS]", "Checks the bundle for common problems"
+ long_desc <<-D
+ Doctor scans the OS dependencies of each of the gems requested in the Gemfile. If
+ missing dependencies are detected, Bundler prints them and exits status 1.
+ Otherwise, Bundler prints a success message and exits with a status of 0.
+ D
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
+ def diagnose
+ require_relative "doctor/diagnose"
+ Diagnose.new(options).run
+ end
+ end
+end
diff --git a/lib/bundler/cli/doctor/diagnose.rb b/lib/bundler/cli/doctor/diagnose.rb
index 160ad13b99..c32a1b5369 100644
--- a/lib/bundler/cli/doctor/diagnose.rb
+++ b/lib/bundler/cli/doctor/diagnose.rb
@@ -65,7 +65,7 @@ module Bundler
end
def check!
- require_relative "check"
+ require_relative "../check"
Bundler::CLI::Check.new({}).run
end
diff --git a/lib/bundler/cli/issue.rb b/lib/bundler/cli/issue.rb
index e16c9b0e39..fbe9184d12 100644
--- a/lib/bundler/cli/issue.rb
+++ b/lib/bundler/cli/issue.rb
@@ -34,8 +34,8 @@ module Bundler
end
def doctor
- require_relative "doctor"
- Bundler::CLI::Doctor.new({}).run
+ require_relative "doctor/diagnose"
+ Bundler::CLI::Doctor::Diagnose.new({}).run
end
end
end