Skip to content

Commit

Permalink
[rubygems/rubygems] Deprecate --dryrun
Browse files Browse the repository at this point in the history
  • Loading branch information
bronzdoc authored and hsbt committed Sep 28, 2020
1 parent b83787b commit be980dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/rubygems/commands/cleanup_command.rb
Expand Up @@ -15,6 +15,12 @@ def initialize
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|
Expand All @@ -41,7 +47,7 @@ def arguments # :nodoc:
end

def defaults_str # :nodoc:
"--no-dryrun"
"--no-dry-run"
end

def description # :nodoc:
Expand Down
11 changes: 11 additions & 0 deletions test/rubygems/test_gem_commands_cleanup_command.rb
Expand Up @@ -26,6 +26,17 @@ def test_handle_options_dry_run
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]
Expand Down

0 comments on commit be980dd

Please sign in to comment.