From d001d4971f84edc89efe21413a8b52e7eb875474 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 10 Nov 2010 03:00:46 -0600 Subject: [PATCH] Closes #707. bundle package removes .gem when source is changed to git --- lib/bundler/runtime.rb | 2 +- spec/cache/gems_spec.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 61d46b0b43f..b4ea8d1a9f0 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -101,7 +101,7 @@ def prune_cache spec = Gem::Format.from_file_by_path(path).spec resolve.any? do |s| - s.name == spec.name && s.version == spec.version + s.name == spec.name && s.version == spec.version && !s.source.is_a?(Bundler::Source::Git) end end diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index 9ed266cd120..f80595ce245 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -153,6 +153,20 @@ cached_gem("activesupport-2.3.2").should_not exist end + it "removes .gems when gem changes to git source" do + build_git "rack" + + install_gemfile <<-G + source "file://#{gem_repo2}" + gem "rack", :git => "#{lib_path("rack-1.0")}" + gem "actionpack" + G + cached_gem("rack-1.0.0").should_not exist + cached_gem("actionpack-2.3.2").should exist + cached_gem("activesupport-2.3.2").should exist + end + + it "doesn't remove gems that are for another platform" do simulate_platform "java" do install_gemfile <<-G