summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-09-27 22:56:02 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-09-27 22:56:02 -0500
commit10108fb1cb4760b477094c9df39860ef48b60ea1 (patch)
tree0c4a47ee2195c87508dfbb7d94bb3c98f5bc7d90
parentcf668f8092be600619fcac5dbcc91072621b0509 (diff)
downloadbundler-10108fb1cb4760b477094c9df39860ef48b60ea1.tar.gz
Add a spec for only_ruby_platform
-rw-r--r--lib/bundler/lazy_specification.rb2
-rw-r--r--lib/bundler/rubygems_integration.rb1
-rw-r--r--spec/runtime/platform_spec.rb16
3 files changed, 18 insertions, 1 deletions
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