diff options
author | Andre Arko <andre@arko.net> | 2010-04-20 23:23:00 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2010-04-20 23:23:09 -0700 |
commit | e13dd685aea0f150a1690710636be0e7b19d4014 (patch) | |
tree | 5eacbd31ca4f8b65347ec3b0b04d194c82bed2ae | |
parent | 391a888868260fee89d416f03b11210af1d8a228 (diff) | |
download | bundler-e13dd685aea0f150a1690710636be0e7b19d4014.tar.gz |
cache command should not prune gems for other platforms
-rw-r--r-- | lib/bundler/runtime.rb | 1 | ||||
-rw-r--r-- | spec/cache/gems_spec.rb | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 09dd0c9350..1c7712ada3 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -99,6 +99,7 @@ module Bundler Bundler.ui.info "Removing outdated .gem files from vendor/cache" cache_path.children.each do |gem_path| cached_spec = Gem::Format.from_file_by_path(gem_path).spec + next unless cached_spec.platform =~ Gem::Platform.local unless specs.any?{|s| s.full_name == cached_spec.full_name } Bundler.ui.info " * #{File.basename(gem_path)}" gem_path.rmtree diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index cf9cf354c6..b41e7777b7 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -116,6 +116,24 @@ describe "bundle cache" do cached_gem("activesupport-2.3.2").should_not exist end + it "doesn't remove gems that are for another platform" do + install_gemfile <<-G + Gem.platforms = [#{java}] + source "file://#{gem_repo1}" + gem "platform_specific" + G + bundle :cache + cached_gem("platform_specific-1.0-java").should exist + + simulate_new_machine + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "platform_specific" + G + cached_gem("platform_specific-1.0-#{Gem::Platform.local}").should exist + cached_gem("platform_specific-1.0-java").should exist + end + it "doesn't remove gems with mismatched :rubygems_version or :date" do cached_gem("rack-1.0.0").rmtree build_gem "rack", "1.0.0", |