summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2018-12-18 12:19:11 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2018-12-19 10:26:45 +0100
commitea6e91bc9e5c0ad2ad3d6b5cdd58bb3e7777d07e (patch)
tree363263be4ab0e3f7b922519d12f6eceb757ced1c
parentac60650be8ba8904aeaa4a0b11318612d2254eb0 (diff)
downloadbundler-ea6e91bc9e5c0ad2ad3d6b5cdd58bb3e7777d07e.tar.gz
Properly deprecate `with_clean_env`
Previously the deprecation would point to the `Bundler.clean_env` method even if not directly used by the end user.
-rw-r--r--lib/bundler.rb10
-rw-r--r--spec/runtime/with_unbundled_env_spec.rb4
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 84634be933..137d916cc6 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -319,9 +319,15 @@ EOF
with_env(original_env) { yield }
end
- # Run block with all bundler-related variables removed
+ # @deprecated Use `with_unbundled_env` instead
def with_clean_env
- with_env(clean_env) { yield }
+ Bundler::SharedHelpers.major_deprecation(
+ 2,
+ "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
+ )
+
+ with_env(unbundled_env) { yield }
end
# Run block with all bundler-related variables removed
diff --git a/spec/runtime/with_unbundled_env_spec.rb b/spec/runtime/with_unbundled_env_spec.rb
index dbefb2a8ce..2c3cc1dbaa 100644
--- a/spec/runtime/with_unbundled_env_spec.rb
+++ b/spec/runtime/with_unbundled_env_spec.rb
@@ -143,8 +143,8 @@ RSpec.describe "Bundler.with_env helpers" do
end
describe "Bundler.with_clean_env" do
- it "should set ENV to clean_env in the block" do
- expected = Bundler.clean_env
+ it "should set ENV to unbundled_env in the block" do
+ expected = Bundler.unbundled_env
actual = Bundler.with_clean_env { ENV.to_hash }
expect(actual).to eq(expected)
end