From 10108fb1cb4760b477094c9df39860ef48b60ea1 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Tue, 27 Sep 2016 22:56:02 -0500 Subject: Add a spec for only_ruby_platform --- lib/bundler/lazy_specification.rb | 2 +- lib/bundler/rubygems_integration.rb | 1 + spec/runtime/platform_spec.rb | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 13e7f5fc3c..ccba575b07 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -69,7 +69,7 @@ module Bundler end def __materialize__ - search_object = Bundler.settings[:specific_platform] ? self : Dependency.new(name, version) + search_object = Bundler.settings[:specific_platform] || Bundler.settings[:only_ruby_platform] ? self : Dependency.new(name, version) @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name source.gemspec.tap {|s| s.source = source } else diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 1c44ef3ddd..877c6a7b70 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -80,6 +80,7 @@ module Bundler end def platforms + return [Gem::Platform::RUBY] if Bundler.settings[:only_ruby_platform] Gem.platforms end diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb index 666864a88c..ab409774b7 100644 --- a/spec/runtime/platform_spec.rb +++ b/spec/runtime/platform_spec.rb @@ -88,4 +88,20 @@ describe "Bundler.setup with multi platform stuff" do expect(the_bundle).to include_gems "nokogiri 1.4.2", "platform_specific 1.0 x86-darwin-100" end + + it "allows specifying only-ruby-platform" do + simulate_platform "java" + + install_gemfile! <<-G + source "file://#{gem_repo1}" + gem "nokogiri" + gem "platform_specific" + G + + bundle! "config only_ruby_platform true" + + bundle! "install" + + expect(the_bundle).to include_gems "nokogiri 1.4.2", "platform_specific 1.0 RUBY" + end end -- cgit v1.2.1