Skip to content
This repository

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

Merged
merged 1 commit into from over 2 years ago

2 participants

Aaron Patterson Yehuda Katz
Aaron Patterson
Collaborator

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.

Yehuda Katz wycats merged commit 95dc86b into from November 30, 2011
Yehuda Katz wycats closed this November 30, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 8 additions and 5 deletions. Show diff stats Hide diff stats

  1. 13  lib/bundler.rb
13  lib/bundler.rb
@@ -287,17 +287,20 @@ def configure_gem_home_and_path
287 287
       if settings[:disable_shared_gems]
288 288
         ENV['GEM_PATH'] = ''
289 289
         ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
  290
+        # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
  291
+        FileUtils.mkdir_p bundle_path.to_s rescue nil
  292
+
  293
+        Bundler.rubygems.clear_paths
290 294
       elsif Bundler.rubygems.gem_dir != bundle_path.to_s
291 295
         possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
292 296
         paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
293 297
         ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
294 298
         ENV["GEM_HOME"] = bundle_path.to_s
295  
-      end
  299
+        # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
  300
+        FileUtils.mkdir_p bundle_path.to_s rescue nil
296 301
 
297  
-      # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
298  
-      FileUtils.mkdir_p bundle_path.to_s rescue nil
299  
-
300  
-      Bundler.rubygems.clear_paths
  302
+        Bundler.rubygems.clear_paths
  303
+      end
301 304
     end
302 305
 
303 306
     def upgrade_lockfile
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.