Skip to content

Commit

Permalink
Merge pull request #3917 from eregon/fix-deprecation-warning-that-wou…
Browse files Browse the repository at this point in the history
…ld-wrongly-config-globally

Fix deprecation messages for `bundle install` flags, the config should be --local as before

(cherry picked from commit dc133dc)
  • Loading branch information
deivid-rodriguez committed Oct 5, 2020
1 parent 2fa6ab6 commit 44e11e1
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 69 deletions.
4 changes: 2 additions & 2 deletions bundler/UPGRADING.md
Expand Up @@ -9,7 +9,7 @@ look like. All these deprecations are printed by default in the Bundler 2.1 rele
If you don't want to deal with deprecations right now and want to toggle them
off, you can do it through configuration. Set the `BUNDLE_SILENCE_DEPRECATIONS`
environment variable to "true", or configure it through `bundle config` either
globally through `bundle config set silence_deprecations true` command, or
globally through `bundle config set --global silence_deprecations true` command, or
locally through `bundle config set --local silence_deprecations true`. From now
on in this document we will assume that all three of these configuration options
are available, but will only mention `bundle config set <option> <value>`.
Expand Down Expand Up @@ -51,7 +51,7 @@ in the upcoming 3 version.
development and test gems. This magic will disappear from bundler 3, and
you will explicitly need to configure it, either through environment
variables, application configuration, or machine configuration. For example,
with `bundle config set without development test`.
with `bundle config set --local without development test`.

The removal of this kind of flag also applies to analogous commands, for
example, to `bundle check --path`.
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler.rb
Expand Up @@ -456,7 +456,7 @@ def system_bindir
# system binaries. If you put '-n foo' in your .gemrc, RubyGems will
# install binstubs there instead. Unfortunately, RubyGems doesn't expose
# that directory at all, so rather than parse .gemrc ourselves, we allow
# the directory to be set as well, via `bundle config set bindir foo`.
# the directory to be set as well, via `bundle config set --local bindir foo`.
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
end

Expand Down
14 changes: 7 additions & 7 deletions bundler/lib/bundler/cli.rb
Expand Up @@ -565,18 +565,18 @@ def viz

desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set gem.coc true`."
method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
:lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
:desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set gem.mit true`."
method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set gem.rubocop true`."
method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
:desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set gem.test (rspec|minitest|test-unit)`."
:desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
:desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set gem.ci (github|travis|gitlab|circle)`"
:desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"

def gem(name)
end
Expand Down Expand Up @@ -744,7 +744,7 @@ def self.reformatted_help_args(args)

# Automatically invoke `bundle install` and resume if
# Bundler.settings[:auto_install] exists. This is set through config cmd
# `bundle config set auto_install 1`.
# `bundle config set --global auto_install 1`.
#
# Note that this method `nil`s out the global Definition object, so it
# should be called first, before you instantiate anything like an
Expand Down Expand Up @@ -842,7 +842,7 @@ def flag_deprecation(name, flag_name, option)
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("-", "_")} " \
"do in future versions. Instead please use `bundle config set --local #{name.tr("-", "_")} " \
"'#{value}'`, and stop using this flag"
end
end
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/dsl.rb
Expand Up @@ -457,7 +457,7 @@ def check_primary_source_safety(source_list)
"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. " \
"To upgrade this warning to an error, run `bundle config set " \
"To upgrade this warning to an error, run `bundle config set --local " \
"disable_multisource true`."
end
end
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/fetcher.rb
Expand Up @@ -47,7 +47,7 @@ def initialize(remote_uri)
remote_uri = filter_uri(remote_uri)
super "Authentication is required for #{remote_uri}.\n" \
"Please supply credentials for this source. You can do this by running:\n" \
" bundle config set #{remote_uri} username:password"
" bundle config set --global #{remote_uri} username:password"
end
end
# This error is raised if HTTP authentication is provided, but incorrect.
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/lazy_specification.rb
Expand Up @@ -89,7 +89,7 @@ def __materialize__
if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \
"because it has different dependencies from the #{platform} version. " \
"To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
"To use the platform-specific version of the gem, run `bundle config set --local specific_platform true` and install again."
search = source.specs.search(self).last
end
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/rubygems_gem_installer.rb
Expand Up @@ -60,7 +60,7 @@ def validate_bundler_checksum(checksum)
If you wish to continue installing the downloaded gem, and are certain it does not pose a \
security issue despite the mismatching checksum, do the following:
1. run `bundle config set disable_checksum_validation true` to turn off checksum verification
1. run `bundle config set --local disable_checksum_validation true` to turn off checksum verification
2. run `bundle install`
(More info: The expected SHA256 checksum was #{checksum.inspect}, but the \
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/source_list.rb
Expand Up @@ -147,7 +147,7 @@ def warn_on_git_protocol(source)
if source.uri =~ /^git\:/
Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
"which transmits data without encryption. Disable this warning with " \
"`bundle config set git.allow_insecure true`, or switch to the `https` " \
"`bundle config set --local git.allow_insecure true`, or switch to the `https` " \
"protocol to keep your data secure."
end
end
Expand Down
24 changes: 12 additions & 12 deletions bundler/man/bundle-config.1
Expand Up @@ -57,13 +57,13 @@ Executing \fBbundle config unset \-\-local <name> <value>\fR will delete the con
Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
.
.P
Executing \fBbundle config set disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\.
Executing \fBbundle config set \-\-local disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\.
.
.SH "REMEMBERING OPTIONS"
Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are remembered between commands and saved to your local application\'s configuration (normally, \fB\./\.bundle/config\fR)\.
.
.P
However, this will be changed in bundler 3, so it\'s better not to rely on this behavior\. If these options must be remembered, it\'s better to set them using \fBbundle config\fR (e\.g\., \fBbundle config set path foo\fR)\.
However, this will be changed in bundler 3, so it\'s better not to rely on this behavior\. If these options must be remembered, it\'s better to set them using \fBbundle config\fR (e\.g\., \fBbundle config set \-\-local path foo\fR)\.
.
.P
The options that can be configured are:
Expand Down Expand Up @@ -111,7 +111,7 @@ Since the specific location of that executable can change from machine to machin
.
.nf

bundle config set build\.mysql \-\-with\-mysql\-config=/usr/local/mysql/bin/mysql_config
bundle config set \-\-global build\.mysql \-\-with\-mysql\-config=/usr/local/mysql/bin/mysql_config
.
.fi
.
Expand Down Expand Up @@ -312,7 +312,7 @@ Bundler also allows you to work against a git repository locally instead of usin
.
.nf

bundle config set local\.GEM_NAME /path/to/local/git/repository
bundle config set \-\-local local\.GEM_NAME /path/to/local/git/repository
.
.fi
.
Expand All @@ -325,7 +325,7 @@ For example, in order to use a local Rack repository, a developer could call:
.
.nf

bundle config set local\.rack ~/Work/git/rack
bundle config set \-\-local local\.rack ~/Work/git/rack
.
.fi
.
Expand All @@ -347,7 +347,7 @@ Bundler supports overriding gem sources with mirrors\. This allows you to config
.
.nf

bundle config set mirror\.SOURCE_URL MIRROR_URL
bundle config set \-\-global mirror\.SOURCE_URL MIRROR_URL
.
.fi
.
Expand All @@ -360,7 +360,7 @@ For example, to use a mirror of rubygems\.org hosted at rubygems\-mirror\.org:
.
.nf

bundle config set mirror\.http://rubygems\.org http://rubygems\-mirror\.org
bundle config set \-\-global mirror\.http://rubygems\.org http://rubygems\-mirror\.org
.
.fi
.
Expand All @@ -373,7 +373,7 @@ Each mirror also provides a fallback timeout setting\. If the mirror does not re
.
.nf

bundle config set mirror\.SOURCE_URL\.fallback_timeout TIMEOUT
bundle config set \-\-global mirror\.SOURCE_URL\.fallback_timeout TIMEOUT
.
.fi
.
Expand All @@ -386,7 +386,7 @@ For example, to fall back to rubygems\.org after 3 seconds:
.
.nf

bundle config set mirror\.https://rubygems\.org\.fallback_timeout 3
bundle config set \-\-global mirror\.https://rubygems\.org\.fallback_timeout 3
.
.fi
.
Expand All @@ -402,7 +402,7 @@ Bundler allows you to configure credentials for any gem source, which allows you
.
.nf

bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
bundle config set \-\-global SOURCE_HOSTNAME USERNAME:PASSWORD
.
.fi
.
Expand All @@ -415,7 +415,7 @@ For example, to save the credentials of user \fBclaudette\fR for the gem source
.
.nf

bundle config set gems\.longerous\.com claudette:s00pers3krit
bundle config set \-\-global gems\.longerous\.com claudette:s00pers3krit
.
.fi
.
Expand All @@ -441,7 +441,7 @@ For gems with a git source with HTTP(S) URL you can specify credentials like so:
.
.nf

bundle config set https://github\.com/bundler/bundler\.git username:password
bundle config set \-\-global https://github\.com/bundler/bundler\.git username:password
.
.fi
.
Expand Down
27 changes: 14 additions & 13 deletions bundler/man/bundle-config.1.txt
Expand Up @@ -58,8 +58,8 @@ DESCRIPTION
Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set
will cause it to ignore all configuration.

Executing bundle config set disable_multisource true upgrades the
warning about the Gemfile containing multiple primary sources to an
Executing bundle config set --local disable_multisource true upgrades
the warning about the Gemfile containing multiple primary sources to an
error. Executing bundle config unset disable_multisource downgrades
this error to a warning.

Expand All @@ -70,7 +70,8 @@ REMEMBERING OPTIONS

However, this will be changed in bundler 3, so it's better not to rely
on this behavior. If these options must be remembered, it's better to
set them using bundle config (e.g., bundle config set path foo).
set them using bundle config (e.g., bundle config set --local path
foo).

The options that can be configured are:

Expand Down Expand Up @@ -120,7 +121,7 @@ BUILD OPTIONS



bundle config set build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
bundle config set --global build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config



Expand Down Expand Up @@ -376,7 +377,7 @@ LOCAL GIT REPOS



bundle config set local.GEM_NAME /path/to/local/git/repository
bundle config set --local local.GEM_NAME /path/to/local/git/repository



Expand All @@ -385,7 +386,7 @@ LOCAL GIT REPOS



bundle config set local.rack ~/Work/git/rack
bundle config set --local local.rack ~/Work/git/rack



Expand Down Expand Up @@ -418,7 +419,7 @@ MIRRORS OF GEM SOURCES



bundle config set mirror.SOURCE_URL MIRROR_URL
bundle config set --global mirror.SOURCE_URL MIRROR_URL



Expand All @@ -427,7 +428,7 @@ MIRRORS OF GEM SOURCES



bundle config set mirror.http://rubygems.org http://rubygems-mirror.org
bundle config set --global mirror.http://rubygems.org http://rubygems-mirror.org



Expand All @@ -437,15 +438,15 @@ MIRRORS OF GEM SOURCES



bundle config set mirror.SOURCE_URL.fallback_timeout TIMEOUT
bundle config set --global mirror.SOURCE_URL.fallback_timeout TIMEOUT



For example, to fall back to rubygems.org after 3 seconds:



bundle config set mirror.https://rubygems.org.fallback_timeout 3
bundle config set --global mirror.https://rubygems.org.fallback_timeout 3



Expand All @@ -458,7 +459,7 @@ CREDENTIALS FOR GEM SOURCES



bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
bundle config set --global SOURCE_HOSTNAME USERNAME:PASSWORD



Expand All @@ -467,7 +468,7 @@ CREDENTIALS FOR GEM SOURCES



bundle config set gems.longerous.com claudette:s00pers3krit
bundle config set --global gems.longerous.com claudette:s00pers3krit



Expand All @@ -484,7 +485,7 @@ CREDENTIALS FOR GEM SOURCES



bundle config set https://github.com/bundler/bundler.git username:password
bundle config set --global https://github.com/bundler/bundler.git username:password



Expand Down

0 comments on commit 44e11e1

Please sign in to comment.