Skip to content

Commit

Permalink
Rename BUNDLE_SPEC_RUN environment variable
Browse files Browse the repository at this point in the history
The `BUNDLE_` prefix should be reserved to first class settings that
should be listed when running `bundle config`. This one is just a hacky
environment variable that has not corresponding documented setting.
  • Loading branch information
deivid-rodriguez committed Dec 20, 2021
1 parent d647ab5 commit 7e255c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/shared_helpers.rb
Expand Up @@ -239,7 +239,7 @@ def search_up(*names)
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }

until !File.directory?(current) || current == previous
if ENV["BUNDLE_SPEC_RUN"]
if ENV["BUNDLER_SPEC_RUN"]
# avoid stepping above the tmp directory when testing
gemspec = if ENV["GEM_COMMAND"]
# for Ruby Core
Expand Down
16 changes: 8 additions & 8 deletions bundler/spec/commands/config_spec.rb
Expand Up @@ -425,27 +425,27 @@

describe "subcommands" do
it "list" do
bundle "config list"
expect(out).to eq "Settings are listed in order of priority. The top value will be used.\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\""
bundle "config list", :env => { "BUNDLE_FOO" => "bar" }
expect(out).to eq "Settings are listed in order of priority. The top value will be used.\nfoo\nSet via BUNDLE_FOO: \"bar\""

bundle "config list", :parseable => true
expect(out).to eq "spec_run=true"
bundle "config list", :env => { "BUNDLE_FOO" => "bar" }, :parseable => true
expect(out).to eq "foo=bar"
end

it "list with credentials" do
bundle "config list", :env => { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" }
expect(out).to eq "Settings are listed in order of priority. The top value will be used.\ngems.myserver.com\nSet via BUNDLE_GEMS__MYSERVER__COM: \"user:[REDACTED]\"\n\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\""
expect(out).to eq "Settings are listed in order of priority. The top value will be used.\ngems.myserver.com\nSet via BUNDLE_GEMS__MYSERVER__COM: \"user:[REDACTED]\""

bundle "config list", :parseable => true, :env => { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" }
expect(out).to eq "gems.myserver.com=user:password\nspec_run=true"
expect(out).to eq "gems.myserver.com=user:password"
end

it "list with API token credentials" do
bundle "config list", :env => { "BUNDLE_GEMS__MYSERVER__COM" => "api_token:x-oauth-basic" }
expect(out).to eq "Settings are listed in order of priority. The top value will be used.\ngems.myserver.com\nSet via BUNDLE_GEMS__MYSERVER__COM: \"[REDACTED]:x-oauth-basic\"\n\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\""
expect(out).to eq "Settings are listed in order of priority. The top value will be used.\ngems.myserver.com\nSet via BUNDLE_GEMS__MYSERVER__COM: \"[REDACTED]:x-oauth-basic\""

bundle "config list", :parseable => true, :env => { "BUNDLE_GEMS__MYSERVER__COM" => "api_token:x-oauth-basic" }
expect(out).to eq "gems.myserver.com=api_token:x-oauth-basic\nspec_run=true"
expect(out).to eq "gems.myserver.com=api_token:x-oauth-basic"
end

it "get" do
Expand Down
2 changes: 1 addition & 1 deletion bundler/spec/spec_helper.rb
Expand Up @@ -71,7 +71,7 @@ def self.ruby=(ruby)

require_relative "support/rubygems_ext"
Spec::Rubygems.test_setup
ENV["BUNDLE_SPEC_RUN"] = "true"
ENV["BUNDLER_SPEC_RUN"] = "true"
ENV["BUNDLE_USER_CONFIG"] = ENV["BUNDLE_USER_CACHE"] = ENV["BUNDLE_USER_PLUGIN"] = nil
ENV["RUBYGEMS_GEMDEPS"] = nil
ENV["XDG_CONFIG_HOME"] = nil
Expand Down

0 comments on commit 7e255c5

Please sign in to comment.