From 4dea1356c3ea97e9d0e98b1fbca69b01a6df2647 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Sun, 25 Nov 2018 13:25:17 +0000 Subject: [bundler/bundler] [CurrentRuby] Say we are ruby? when the generic local platform is Gem::Platform::RUBY This allows us to always say we're ruby? when force_ruby_platform is set, and fixes using gemspec & force_ruby_platform on windows. https://github.com/bundler/bundler/commit/3cb89b7e5c --- lib/bundler/current_ruby.rb | 2 ++ spec/bundler/runtime/platform_spec.rb | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index 6c8ad72ee3..c132e8ecc0 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -38,6 +38,8 @@ module Bundler ].freeze def ruby? + return true if Bundler::GemHelpers.generic_local_platform == Gem::Platform::RUBY + !mswin? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby") end diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb index ee006433fe..c504685ea3 100644 --- a/spec/bundler/runtime/platform_spec.rb +++ b/spec/bundler/runtime/platform_spec.rb @@ -116,6 +116,25 @@ RSpec.describe "Bundler.setup with multi platform stuff" do end end + it "allows specifying only-ruby-platform on windows with gemspec dependency" do + build_lib("foo", "1.0", :path => ".") do |s| + s.add_dependency "rack" + end + + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gemspec + G + bundle! :lock + + simulate_windows do + bundle! "config set force_ruby_platform true" + bundle! "install" + + expect(the_bundle).to include_gems "rack 1.0" + end + end + it "recovers when the lockfile is missing a platform-specific gem" do build_repo2 do build_gem "requires_platform_specific" do |s| -- cgit v1.2.3