mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[rubygems/rubygems] Fix bundle cache path=foo
not printing a deprecation message
0af03eea5d
This commit is contained in:
parent
249cf5397f
commit
19d931b50d
2 changed files with 28 additions and 4 deletions
|
@ -414,7 +414,7 @@ module Bundler
|
||||||
def cache
|
def cache
|
||||||
print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
|
print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
|
||||||
|
|
||||||
if ARGV.include?("--path")
|
if flag_passed?("--path")
|
||||||
message =
|
message =
|
||||||
"The `--path` flag is deprecated because its semantics are unclear. " \
|
"The `--path` flag is deprecated because its semantics are unclear. " \
|
||||||
"Use `bundle config cache_path` to configure the path of your cache of gems, " \
|
"Use `bundle config cache_path` to configure the path of your cache of gems, " \
|
||||||
|
@ -747,9 +747,7 @@ module Bundler
|
||||||
option = current_command.options[name]
|
option = current_command.options[name]
|
||||||
flag_name = option.switch_name
|
flag_name = option.switch_name
|
||||||
flag_name = "--no-" + flag_name.gsub(/\A--/, "") if negative
|
flag_name = "--no-" + flag_name.gsub(/\A--/, "") if negative
|
||||||
|
return unless flag_passed?(flag_name)
|
||||||
name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
|
|
||||||
return unless name_index
|
|
||||||
|
|
||||||
value = options[name]
|
value = options[name]
|
||||||
value = value.join(" ").to_s if option.type == :array
|
value = value.join(" ").to_s if option.type == :array
|
||||||
|
@ -771,5 +769,9 @@ module Bundler
|
||||||
"#{option_value}`, and stop using this flag"
|
"#{option_value}`, and stop using this flag"
|
||||||
Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
|
Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def flag_passed?(name)
|
||||||
|
ARGV.any? {|arg| name == arg.split("=")[0] }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -199,6 +199,28 @@ RSpec.describe "major deprecations" do
|
||||||
pending "fails with a helpful error", bundler: "4"
|
pending "fails with a helpful error", bundler: "4"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "bundle cache --path=" do
|
||||||
|
before do
|
||||||
|
install_gemfile <<-G
|
||||||
|
source "https://gem.repo1"
|
||||||
|
gem "myrack"
|
||||||
|
G
|
||||||
|
|
||||||
|
bundle "cache --path=foo", raise_on_error: false
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should print a deprecation warning" do
|
||||||
|
expect(deprecations).to include(
|
||||||
|
"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"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
pending "fails with a helpful error", bundler: "4"
|
||||||
|
end
|
||||||
|
|
||||||
describe "bundle config" do
|
describe "bundle config" do
|
||||||
describe "old list interface" do
|
describe "old list interface" do
|
||||||
before do
|
before do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue