Skip to content

Commit

Permalink
Deprecate the --no-deployment flag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
deivid-rodriguez committed May 25, 2020
1 parent b368c7e commit 40e50b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bundler/lib/bundler/cli.rb
Expand Up @@ -254,6 +254,8 @@ def install
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
Expand Down Expand Up @@ -812,10 +814,22 @@ def warn_on_outdated_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

Expand Down
1 change: 1 addition & 0 deletions bundler/spec/other/major_deprecation_spec.rb
Expand Up @@ -318,6 +318,7 @@
"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"],
Expand Down

0 comments on commit 40e50b7

Please sign in to comment.