1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Deprecate --dryrun

https://github.com/rubygems/rubygems/commit/1715610648
This commit is contained in:
bronzdoc 2020-08-31 00:21:20 -06:00 committed by Hiroshi SHIBATA
parent b83787b1ce
commit be980dd9fa
Notes: git 2020-09-28 14:54:57 +09:00
2 changed files with 18 additions and 1 deletions

View file

@ -15,6 +15,12 @@ class Gem::Commands::CleanupCommand < Gem::Command
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
end
def defaults_str # :nodoc:
"--no-dryrun"
"--no-dry-run"
end
def description # :nodoc:

View file

@ -26,6 +26,17 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
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]