ruby-changes:61486
From: David <ko1@a...>
Date: Fri, 5 Jun 2020 07:33:16 +0900 (JST)
Subject: [ruby-changes:61486] d52b1b0705 (master): [rubygems/rubygems] Deprecate the `--no-deployment` flag
https://git.ruby-lang.org/ruby.git/commit/?id=d52b1b0705 From d52b1b0705a6aa5587350ce01b293ed6bf7bdad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Mon, 25 May 2020 12:19:13 +0200 Subject: [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 diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index f761328..3d5194d 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -254,6 +254,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L254 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 https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L814 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 diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index 102588e..c8023dc 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -318,6 +318,7 @@ RSpec.describe "major deprecations" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/other/major_deprecation_spec.rb#L318 "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"], -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/