ruby-changes:63157
From: bronzdoc <ko1@a...>
Date: Mon, 28 Sep 2020 14:54:43 +0900 (JST)
Subject: [ruby-changes:63157] be980dd9fa (master): [rubygems/rubygems] Deprecate --dryrun
https://git.ruby-lang.org/ruby.git/commit/?id=be980dd9fa From be980dd9fa99dc42b064ce596240f7623b97f1fb Mon Sep 17 00:00:00 2001 From: bronzdoc <lsagastume1990@g...> Date: Mon, 31 Aug 2020 00:21:20 -0600 Subject: [rubygems/rubygems] Deprecate --dryrun https://github.com/rubygems/rubygems/commit/1715610648 diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb index 996733c..9c38b30 100644 --- a/lib/rubygems/commands/cleanup_command.rb +++ b/lib/rubygems/commands/cleanup_command.rb @@ -15,6 +15,12 @@ class Gem::Commands::CleanupCommand < Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/cleanup_command.rb#L15 options[:dryrun] = true end + add_option('-n', '-d', '--dryrun', + 'Do not uninstall gems') do |value, options| + options[:dryrun] = true + end + deprecate_option('--dryrun', extra_msg: 'Use --dry-run instead') + add_option('-D', '--[no-]check-development', 'Check development dependencies while uninstalling', '(default: true)') do |value, options| @@ -41,7 +47,7 @@ class Gem::Commands::CleanupCommand < Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/cleanup_command.rb#L47 end def defaults_str # :nodoc: - "--no-dryrun" + "--no-dry-run" end def description # :nodoc: diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb index 47d953d..81f9a24 100644 --- a/test/rubygems/test_gem_commands_cleanup_command.rb +++ b/test/rubygems/test_gem_commands_cleanup_command.rb @@ -26,6 +26,17 @@ class TestGemCommandsCleanupCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_cleanup_command.rb#L26 assert @cmd.options[:dryrun] end + def test_handle_options_deprecated_dry_run + use_ui @ui do + @cmd.handle_options %w[--dryrun] + assert @cmd.options[:dryrun] + end + + assert_equal \ + "WARNING: The \"--dryrun\" option has been deprecated and will be removed in future versions of Rubygems. Use --dry-run instead\n", + @ui.error + end + def test_handle_options_n @cmd.handle_options %w[-n] assert @cmd.options[:dryrun] -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/