diff options
author | Eric Mueller <nevinera@gmail.com> | 2023-11-29 22:40:10 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-01 17:52:38 +0000 |
commit | 73440e1ef21e1dd7ca590e402d37b835b9b1f0bb (patch) | |
tree | 7757e2c5e22bde407cb90fded3ca17465eddb176 | |
parent | 079dfa1812e0f23a74c86e271245504b069b4c17 (diff) |
[rubygems/rubygems] Many major_deprecations supply :removed_message
Generally the removed message is very similar, but often it needs to
specify that the feature has "been removed" instead of "will be
removed", or "been deprecated". And a few chunks of text needed more
substantial updates. And a number of them seemed to have been carefully
crafted to make sense in either context, so I left those alone.
https://github.com/rubygems/rubygems/commit/8d42cf9104
-rw-r--r-- | lib/bundler.rb | 48 | ||||
-rw-r--r-- | lib/bundler/cli.rb | 46 | ||||
-rw-r--r-- | lib/bundler/cli/config.rb | 5 | ||||
-rw-r--r-- | lib/bundler/cli/console.rb | 5 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 11 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 3 | ||||
-rw-r--r-- | lib/bundler/dsl.rb | 19 |
7 files changed, 91 insertions, 46 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index bc28b24e2e..f4f9891247 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -346,13 +346,13 @@ module Bundler # @deprecated Use `unbundled_env` instead def clean_env - Bundler::SharedHelpers.major_deprecation( - 2, + message = "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \ - "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`", - :print_caller_location => true - ) - + "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`" + removed_message = + "`Bundler.clean_env` has been removed in favor of `Bundler.unbundled_env`. " \ + "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`" + Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) unbundled_env end @@ -389,13 +389,13 @@ module Bundler # @deprecated Use `with_unbundled_env` instead def with_clean_env - Bundler::SharedHelpers.major_deprecation( - 2, + message = "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \ - "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`", - :print_caller_location => true - ) - + "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`" + removed_message = + "`Bundler.with_clean_env` has been removed in favor of `Bundler.with_unbundled_env`. " \ + "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`" + Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) with_env(unbundled_env) { yield } end @@ -411,13 +411,13 @@ module Bundler # @deprecated Use `unbundled_system` instead def clean_system(*args) - Bundler::SharedHelpers.major_deprecation( - 2, + message = "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \ - "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`", - :print_caller_location => true - ) - + "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`" + removed_message = + "`Bundler.clean_system` has been removed in favor of `Bundler.unbundled_system`. " \ + "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`" + Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) with_env(unbundled_env) { Kernel.system(*args) } end @@ -433,13 +433,13 @@ module Bundler # @deprecated Use `unbundled_exec` instead def clean_exec(*args) - Bundler::SharedHelpers.major_deprecation( - 2, + message = "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \ - "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`", - :print_caller_location => true - ) - + "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`" + removed_message = + "`Bundler.clean_exec` has been removed in favor of `Bundler.unbundled_exec`. " \ + "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`" + Bundler::SharedHelpers.major_deprecation(2, message, :removed_message => removed_message, :print_caller_location => true) with_env(unbundled_env) { Kernel.exec(*args) } end diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index c2fa92d875..f90ddf4147 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -190,7 +190,12 @@ module Bundler method_option "install", :type => :boolean, :banner => "Runs 'bundle install' after removing the gems from the Gemfile" def remove(*gems) - SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install") + if ARGV.include?("--install") + message = "The `--install` flag has been deprecated. `bundle install` is triggered by default." + removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default." + SharedHelpers.major_deprecation(2, message, :removed_message => removed_message) + end + require_relative "cli/remove" Remove.new(gems, options).run end @@ -324,7 +329,11 @@ module Bundler method_option "outdated", :type => :boolean, :banner => "Show verbose output including whether gems are outdated." def show(gem_name = nil) - SharedHelpers.major_deprecation(2, "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") if ARGV.include?("--outdated") + if ARGV.include?("--outdated") + message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement" + removed_message = "the `--outdated` flag to `bundle show` was undocumented and has been removed without replacement" + SharedHelpers.major_deprecation(2, message, :removed_message => removed_message) + end require_relative "cli/show" Show.new(options, gem_name).run end @@ -462,11 +471,18 @@ module Bundler def cache print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all") - SharedHelpers.major_deprecation 2, - "The `--path` flag is deprecated because its semantics are unclear. " \ - "Use `bundle config cache_path` to configure the path of your cache of gems, " \ - "and `bundle config path` to configure the path where your gems are installed, " \ - "and stop using this flag" if ARGV.include?("--path") + if ARGV.include?("--path") + message = + "The `--path` flag is deprecated because its semantics are unclear. " \ + "Use `bundle config cache_path` to configure the path of your cache of gems, " \ + "and `bundle config path` to configure the path where your gems are installed, " \ + "and stop using this flag" + removed_message = + "The `--path` flag has been removed because its semantics were unclear. " \ + "Use `bundle config cache_path` to configure the path of your cache of gems, " \ + "and `bundle config path` to configure the path where your gems are installed." + SharedHelpers.major_deprecation 2, message, :removed_message => removed_message + end require_relative "cli/cache" Cache.new(options).run @@ -484,7 +500,9 @@ module Bundler D def exec(*args) if ARGV.include?("--no-keep-file-descriptors") - SharedHelpers.major_deprecation(2, "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to") + message = "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to" + removed_message = "The `--no-keep-file-descriptors` has been removed. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to" + SharedHelpers.major_deprecation(2, message, :removed_message => removed_message) end require_relative "cli/exec" @@ -763,7 +781,9 @@ module Bundler # when deprecated version of `--ext` is called # print out deprecation warning and pretend `--ext=c` was provided if deprecated_ext_value?(arguments) - SharedHelpers.major_deprecation 2, "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been deprecated. Please select a language, e.g. `--ext=rust` to generate a Rust extension. This gem will now be generated as if `--ext=c` was used." + message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been deprecated. Please select a language, e.g. `--ext=rust` to generate a Rust extension. This gem will now be generated as if `--ext=c` was used." + removed_message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension." + SharedHelpers.major_deprecation 2, message, :removed_message => removed_message arguments[arguments.index("--ext")] = "--ext=c" end end @@ -888,11 +908,17 @@ module Bundler end def print_remembered_flag_deprecation(flag_name, option_name, option_value) - Bundler::SharedHelpers.major_deprecation 2, + message = "The `#{flag_name}` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no longer " \ "do in future versions. Instead please use `bundle config set #{option_name} " \ "#{option_value}`, and stop using this flag" + removed_message = + "The `#{flag_name}` flag has been removed because it relied on being " \ + "remembered across bundler invocations, which bundler will no longer " \ + "do. Instead please use `bundle config set #{option_name} " \ + "#{option_value}`, and stop using this flag" + Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message end end end diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb index e1222c75dd..30b22cf2d5 100644 --- a/lib/bundler/cli/config.rb +++ b/lib/bundler/cli/config.rb @@ -25,8 +25,9 @@ module Bundler ["config", "get", ARGV[1]] end - SharedHelpers.major_deprecation 3, - "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead." + message = "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead." + removed_message = "Using the `config` command without a subcommand [list, get, set, unset] is has been removed. Use `bundle #{new_args.join(" ")}` instead." + SharedHelpers.major_deprecation 3, message, :removed_message => removed_message Base.new(options, name, value, self).run end diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb index 1eb8ea8254..a3891723f9 100644 --- a/lib/bundler/cli/console.rb +++ b/lib/bundler/cli/console.rb @@ -9,8 +9,9 @@ module Bundler end def run - Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \ - "by `bin/console` generated by `bundle gem <name>`" + message = "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`" + removed_message = "bundle console has been replaced by `bin/console` generated by `bundle gem <name>`" + Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message group ? Bundler.require(:default, *group.split(" ").map!(&:to_sym)) : Bundler.require ARGV.clear diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index fb064ed702..aef45d19e1 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -380,15 +380,20 @@ module Bundler def deprecated_rubocop_option if !options[:rubocop].nil? if options[:rubocop] - Bundler::SharedHelpers.major_deprecation 2, "--rubocop is deprecated, use --linter=rubocop" + Bundler::SharedHelpers.major_deprecation 2, + "--rubocop is deprecated, use --linter=rubocop", + :removed_message => "--rubocop has been removed, use --linter=rubocop" "rubocop" else - Bundler::SharedHelpers.major_deprecation 2, "--no-rubocop is deprecated, use --linter" + Bundler::SharedHelpers.major_deprecation 2, + "--no-rubocop is deprecated, use --linter", + :removed_message => "--no-rubocop has been removed, use --linter" false end elsif !Bundler.settings["gem.rubocop"].nil? Bundler::SharedHelpers.major_deprecation 2, - "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead" + "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead", + :removed_message => "config gem.rubocop has been removed; we've updated your config to use gem.linter instead" Bundler.settings["gem.rubocop"] ? "rubocop" : false end end diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index f7228db623..c7d287e45f 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -51,7 +51,8 @@ module Bundler if options["binstubs"] Bundler::SharedHelpers.major_deprecation 2, - "The --binstubs option will be removed in favor of `bundle binstubs --all`" + "The --binstubs option will be removed in favor of `bundle binstubs --all`", + :removed_message => "The --binstubs option have been removed in favor of `bundle binstubs --all`" end Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins? diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index db59e1a372..f3968d8a6e 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -427,9 +427,13 @@ module Bundler def normalize_source(source) case source when :gemcutter, :rubygems, :rubyforge - Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \ - "requests are insecure.\nPlease change your source to 'https://" \ - "rubygems.org' if possible, or 'http://rubygems.org' if not." + message = + "The source :#{source} is deprecated because HTTP requests are insecure.\n" \ + "Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not." + removed_message = + "The source :#{source} is disallowed because HTTP requests are insecure.\n" \ + "Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not." + Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message "http://rubygems.org" when String source @@ -474,10 +478,17 @@ module Bundler "should come from that source" raise GemfileEvalError, msg else - Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple global sources. " \ + message = + "Your Gemfile contains multiple global sources. " \ "Using `source` more than once without a block is a security risk, and " \ "may result in installing unexpected gems. To resolve this warning, use " \ "a block to indicate which gems should come from the secondary source." + removed_message = + "Your Gemfile contains multiple global sources. " \ + "Using `source` more than once without a block is a security risk, and " \ + "may result in installing unexpected gems. To resolve this error, use " \ + "a block to indicate which gems should come from the secondary source." + Bundler::SharedHelpers.major_deprecation 2, message, :removed_message => removed_message end end |