Skip to content

Commit

Permalink
Keep a single copy of the remembered flag deprecation message
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Nov 24, 2023
1 parent f2abe08 commit cb4e26e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bundler/lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,7 @@ def fund
bundle without having to download any additional gems.
D
def cache
SharedHelpers.major_deprecation 2,
"The `--all` 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 cache_all true`, " \
"and stop using this flag" if ARGV.include?("--all")
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. " \
Expand Down Expand Up @@ -886,11 +882,15 @@ def flag_deprecation(name, flag_name, option)
value = value.join(" ").to_s if option.type == :array
value = "'#{value}'" unless option.type == :boolean

print_remembered_flag_deprecation(flag_name, name.tr("-", "_"), value)
end

def print_remembered_flag_deprecation(flag_name, option_name, option_value)
Bundler::SharedHelpers.major_deprecation 2,
"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 #{name.tr("-", "_")} " \
"#{value}`, and stop using this flag"
"do in future versions. Instead please use `bundle config set #{option_name} " \
"#{option_value}`, and stop using this flag"
end
end
end

0 comments on commit cb4e26e

Please sign in to comment.