1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[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
This commit is contained in:
Samuel Giddins 2018-11-25 13:25:17 +00:00 committed by Hiroshi SHIBATA
parent 6fb73e6043
commit 4dea1356c3
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 21 additions and 0 deletions

View file

@ -38,6 +38,8 @@ module Bundler
].freeze ].freeze
def ruby? 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") !mswin? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
end end

View file

@ -116,6 +116,25 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
end end
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 it "recovers when the lockfile is missing a platform-specific gem" do
build_repo2 do build_repo2 do
build_gem "requires_platform_specific" do |s| build_gem "requires_platform_specific" do |s|