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

[rubygems/rubygems] Deprecate the --no-deployment flag

And never recommend it inside CLI messages.

This flag represents the default behaviour of `bundle install`, and the
only reason it exists is to "override" previous `--deployment` flag
usages which were silently remembered. So it should be deprecated just
like all the other flags the rely on remembering their values across
invocations.

https://github.com/rubygems/rubygems/commit/40e50b7190
This commit is contained in:
David Rodríguez 2020-05-25 12:19:13 +02:00 committed by Hiroshi SHIBATA
parent 97267227bb
commit d52b1b0705
Notes: git 2020-06-05 07:34:06 +09:00
2 changed files with 15 additions and 0 deletions

View file

@ -254,6 +254,8 @@ module Bundler
remembered_flag_deprecation(option)
end
remembered_negative_flag_deprecation("no-deployment")
require_relative "cli/install"
Bundler.settings.temporary(:no_install => false) do
Install.new(options.dup).run
@ -812,10 +814,22 @@ module Bundler
nil
end
def remembered_negative_flag_deprecation(name)
positive_name = name.gsub(/\Ano-/, "")
option = current_command.options[positive_name]
flag_name = "--no-" + option.switch_name.gsub(/\A--/, "")
flag_deprecation(positive_name, flag_name, option)
end
def remembered_flag_deprecation(name)
option = current_command.options[name]
flag_name = option.switch_name
flag_deprecation(name, flag_name, option)
end
def flag_deprecation(name, flag_name, option)
name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
return unless name_index

View file

@ -318,6 +318,7 @@ RSpec.describe "major deprecations" do
"deployment" => ["deployment", true],
"frozen" => ["frozen", true],
"no-cache" => ["no_cache", true],
"no-deployment" => ["deployment", false],
"no-prune" => ["no_prune", true],
"path" => ["path", "vendor/bundle"],
"shebang" => ["shebang", "ruby27"],