diff options
author | Homu <homu@barosl.com> | 2016-08-11 17:23:50 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-08-11 17:23:50 +0900 |
commit | c0e10ebf782b902ed1870f387c5e0268fb398a98 (patch) | |
tree | d11863652dd9a689c08f04eb9b665e34274bb5f0 | |
parent | 2c1931429d59e1d701bf27c7e3c186fc47f63333 (diff) | |
parent | c1e168dcd51e14f67373a6190cba153be50662f5 (diff) | |
download | bundler-c0e10ebf782b902ed1870f387c5e0268fb398a98.tar.gz |
Auto merge of #4868 - bundler:aa-orig-env-rename, r=segiddins
Rename all BUNDLE_ORIG_* env to BUNDLER_ORIG*
Any enviroment variable that starts with BUNDLE_ will be treated as a
configurationg setting, printed by `bundle config`, and made available
internally via `Bundler.settings`. The ORIG_* environment variables are
actually just internal housekeeping to enable us to provide clean
non-bundled environments, and so they shouldn't show up as settings.
This change to the environment variable names makes sure it is still
clear where they are coming from, but no longer surfaces them via
config/settings.
-rw-r--r-- | lib/bundler.rb | 4 | ||||
-rw-r--r-- | lib/bundler/environment_preserver.rb | 2 | ||||
-rw-r--r-- | lib/bundler/runtime.rb | 2 | ||||
-rw-r--r-- | spec/bundler/environment_preserver_spec.rb | 18 | ||||
-rw-r--r-- | spec/runtime/with_clean_env_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/helpers.rb | 6 |
6 files changed, 17 insertions, 17 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 307f6e5d05..d9e7e6db6d 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -214,8 +214,8 @@ module Bundler Bundler::SharedHelpers.major_deprecation("`Bundler.clean_env` has weird edge cases, use `.original_env` instead") env = original_env - if env.key?("BUNDLE_ORIG_MANPATH") - env["MANPATH"] = env["BUNDLE_ORIG_MANPATH"] + if env.key?("BUNDLER_ORIG_MANPATH") + env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"] end env.delete_if {|k, _| k[0, 7] == "BUNDLE_" } diff --git a/lib/bundler/environment_preserver.rb b/lib/bundler/environment_preserver.rb index 5aaa46b1d8..a891f4854d 100644 --- a/lib/bundler/environment_preserver.rb +++ b/lib/bundler/environment_preserver.rb @@ -6,7 +6,7 @@ module Bundler def initialize(env, keys) @original = env.to_hash @keys = keys - @prefix = "BUNDLE_ORIG_" + @prefix = "BUNDLER_ORIG_" end # @return [Hash] diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index fb2c76bc0c..fda499cf5a 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -270,7 +270,7 @@ module Bundler def setup_manpath # Store original MANPATH for restoration later in with_clean_env() - ENV["BUNDLE_ORIG_MANPATH"] = ENV["MANPATH"] + ENV["BUNDLER_ORIG_MANPATH"] = ENV["MANPATH"] # Add man/ subdirectories from activated bundles to MANPATH for man(1) manuals = $LOAD_PATH.map do |path| diff --git a/spec/bundler/environment_preserver_spec.rb b/spec/bundler/environment_preserver_spec.rb index 0c2913cc37..496646d654 100644 --- a/spec/bundler/environment_preserver_spec.rb +++ b/spec/bundler/environment_preserver_spec.rb @@ -9,7 +9,7 @@ describe Bundler::EnvironmentPreserver do subject { preserver.backup } it "should create backup entries" do - expect(subject["BUNDLE_ORIG_foo"]).to eq("my-foo") + expect(subject["BUNDLER_ORIG_foo"]).to eq("my-foo") end it "should keep the original entry" do @@ -17,7 +17,7 @@ describe Bundler::EnvironmentPreserver do end it "should not create backup entries for unspecified keys" do - expect(subject.key?("BUNDLE_ORIG_bar")).to eq(false) + expect(subject.key?("BUNDLER_ORIG_bar")).to eq(false) end it "should not affect the original env" do @@ -29,15 +29,15 @@ describe Bundler::EnvironmentPreserver do let(:env) { { "foo" => "" } } it "should not create backup entries" do - expect(subject.key?("BUNDLE_ORIG_foo")).to eq(false) + expect(subject.key?("BUNDLER_ORIG_foo")).to eq(false) end end context "when an original key is set" do - let(:env) { { "foo" => "my-foo", "BUNDLE_ORIG_foo" => "orig-foo" } } + let(:env) { { "foo" => "my-foo", "BUNDLER_ORIG_foo" => "orig-foo" } } - it "should keep the original value in the BUNDLE_ORIG_ variable" do - expect(subject["BUNDLE_ORIG_foo"]).to eq("orig-foo") + it "should keep the original value in the BUNDLER_ORIG_ variable" do + expect(subject["BUNDLER_ORIG_foo"]).to eq("orig-foo") end it "should keep the variable" do @@ -50,14 +50,14 @@ describe Bundler::EnvironmentPreserver do subject { preserver.restore } context "when an original key is set" do - let(:env) { { "foo" => "my-foo", "BUNDLE_ORIG_foo" => "orig-foo" } } + let(:env) { { "foo" => "my-foo", "BUNDLER_ORIG_foo" => "orig-foo" } } it "should restore the original value" do expect(subject["foo"]).to eq("orig-foo") end it "should delete the backup value" do - expect(subject.key?("BUNDLE_ORIG_foo")).to eq(false) + expect(subject.key?("BUNDLER_ORIG_foo")).to eq(false) end end @@ -70,7 +70,7 @@ describe Bundler::EnvironmentPreserver do end context "when the original key is empty" do - let(:env) { { "foo" => "my-foo", "BUNDLE_ORIG_foo" => "" } } + let(:env) { { "foo" => "my-foo", "BUNDLER_ORIG_foo" => "" } } it "should keep the current value" do expect(subject["foo"]).to eq("my-foo") diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index b2ab088370..752754be39 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -78,7 +78,7 @@ describe "Bundler.with_env helpers" do it "should restore the original MANPATH" do code = "print Bundler.clean_env['MANPATH']" ENV["MANPATH"] = "/foo" - ENV["BUNDLE_ORIG_MANPATH"] = "/foo-original" + ENV["BUNDLER_ORIG_MANPATH"] = "/foo-original" result = bundle("exec ruby -e #{code.inspect}") expect(result).to eq("/foo-original") end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 0f4e6f0402..fe79604f30 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -256,7 +256,7 @@ module Spec backup = ENV.to_hash ENV["GEM_HOME"] = path.to_s ENV["GEM_PATH"] = path.to_s - ENV["BUNDLE_ORIG_GEM_PATH"] = nil + ENV["BUNDLER_ORIG_GEM_PATH"] = nil yield ensure ENV.replace(backup) @@ -265,7 +265,7 @@ module Spec def with_path_as(path) backup = ENV.to_hash ENV["PATH"] = path.to_s - ENV["BUNDLE_ORIG_PATH"] = nil + ENV["BUNDLER_ORIG_PATH"] = nil yield ensure ENV.replace(backup) @@ -305,7 +305,7 @@ module Spec env_backup = ENV.to_hash ENV["GEM_HOME"] = system_gem_path.to_s ENV["GEM_PATH"] = system_gem_path.to_s - ENV["BUNDLE_ORIG_GEM_PATH"] = nil + ENV["BUNDLER_ORIG_GEM_PATH"] = nil install_gems(*gems) return unless block_given? |