aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/runtime.rb1
-rw-r--r--spec/cache/gems_spec.rb18
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 5df14983..f5bf62f0 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -83,6 +83,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 c9e7f662..2f47879b 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",