Skip to content

Commit

Permalink
Use with_unbundled_env for Bundler 2.1+ (#2151)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Mar 7, 2020
1 parent c87cff2 commit 95aaa99
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/puma/launcher.rb
Expand Up @@ -299,7 +299,7 @@ def prune_bundler
log '* Pruning Bundler environment'
home = ENV['GEM_HOME']
bundle_gemfile = ENV['BUNDLE_GEMFILE']
Bundler.with_clean_env do
with_unbundled_env do
ENV['GEM_HOME'] = home
ENV['BUNDLE_GEMFILE'] = bundle_gemfile
ENV['PUMA_BUNDLER_PRUNED'] = '1'
Expand Down Expand Up @@ -473,5 +473,14 @@ def require_rubygems_min_version!(min_version, feature)
raise "#{feature} is not supported on your version of RubyGems. " \
"You must have RubyGems #{min_version}+ to use this feature."
end

def with_unbundled_env
bundler_ver = Gem::Version.new(Bundler::VERSION)
if bundler_ver < Gem::Version.new('2.1.0')
Bundler.with_clean_env { yield }
else
Bundler.with_unbundled_env { yield }
end
end
end
end

0 comments on commit 95aaa99

Please sign in to comment.