Skip to content

Loading…

do not clear RG cache unless we actually modify GEM_PATH and GEM_HOME #1567

Merged
merged 1 commit into from

2 participants

@tenderlove

Clearning rubygems cache causes all gemspecs to be re-read from disk. This patch only clears rubygem's cache when GEM_HOME and GEM_PATH are actually changed.

@wycats wycats merged commit 95dc86b into bundler:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/bundler.rb
View
13 lib/bundler.rb
@@ -287,17 +287,20 @@ def configure_gem_home_and_path
if settings[:disable_shared_gems]
ENV['GEM_PATH'] = ''
ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
+ # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
+ FileUtils.mkdir_p bundle_path.to_s rescue nil
+
+ Bundler.rubygems.clear_paths
elsif Bundler.rubygems.gem_dir != bundle_path.to_s
possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = bundle_path.to_s
- end
+ # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
+ FileUtils.mkdir_p bundle_path.to_s rescue nil
- # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
- FileUtils.mkdir_p bundle_path.to_s rescue nil
-
- Bundler.rubygems.clear_paths
+ Bundler.rubygems.clear_paths
+ end
end
def upgrade_lockfile
Something went wrong with that request. Please try again.