Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Process gemspecs for gems cached from Git
Browse files Browse the repository at this point in the history
This commit loads gemspecs for gems cached from Git repositories after
checkout, and replaces their contents with the results of calling
#to_ruby on the resulting Gem::Specification. This lets us remove the
(potentially huge) '.git' directories from the cache and avoid errors
for gems whose gemspecs shell out to Git.
  • Loading branch information
bison authored and indirect committed Dec 8, 2012
1 parent 855e4b4 commit 781808a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/bundler/source/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ def cache(spec)
FileUtils.rm_rf(app_cache_path)
git_proxy.checkout if requires_checkout?
git_proxy.copy_to(app_cache_path, @submodules)

# Process any gemspecs before removing '.git'
Dir.glob(app_cache_path.join("*.gemspec")).each do |spec_path|
Dir.chdir(File.dirname(spec_path)) do
spec = Gem::Specification.load(spec_path)
File.write(spec_path, spec.to_ruby)
end
end

FileUtils.rm_rf(app_cache_path.join(".git"))
FileUtils.touch(app_cache_path.join(".bundlecache"))
end
Expand Down Expand Up @@ -264,4 +273,4 @@ def git_proxy
end

end
end
end

0 comments on commit 781808a

Please sign in to comment.