Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bundler/lib/bundler/current_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class CurrentRuby
# deprecated
mswin: [Gem::Platform::MSWIN, CurrentRuby::ALL_RUBY_VERSIONS],
mswin64: [Gem::Platform::MSWIN64, CurrentRuby::ALL_RUBY_VERSIONS - [18]],
mingw: [Gem::Platform::MINGW, CurrentRuby::ALL_RUBY_VERSIONS],
x64_mingw: [Gem::Platform::X64_MINGW, CurrentRuby::ALL_RUBY_VERSIONS - [18, 19]],
mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS],
x64_mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS - [18, 19]],
}.each_with_object({}) do |(platform, spec), hash|
hash[platform] = spec[0]
spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }
Expand Down
64 changes: 32 additions & 32 deletions bundler/spec/bundler/current_ruby_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,38 +98,38 @@
mswin64_33: Gem::Platform::MSWIN64,
mswin64_34: Gem::Platform::MSWIN64,
mswin64_35: Gem::Platform::MSWIN64,
mingw: Gem::Platform::MINGW,
mingw_18: Gem::Platform::MINGW,
mingw_19: Gem::Platform::MINGW,
mingw_20: Gem::Platform::MINGW,
mingw_21: Gem::Platform::MINGW,
mingw_22: Gem::Platform::MINGW,
mingw_23: Gem::Platform::MINGW,
mingw_24: Gem::Platform::MINGW,
mingw_25: Gem::Platform::MINGW,
mingw_26: Gem::Platform::MINGW,
mingw_27: Gem::Platform::MINGW,
mingw_30: Gem::Platform::MINGW,
mingw_31: Gem::Platform::MINGW,
mingw_32: Gem::Platform::MINGW,
mingw_33: Gem::Platform::MINGW,
mingw_34: Gem::Platform::MINGW,
mingw_35: Gem::Platform::MINGW,
x64_mingw: Gem::Platform::X64_MINGW,
x64_mingw_20: Gem::Platform::X64_MINGW,
x64_mingw_21: Gem::Platform::X64_MINGW,
x64_mingw_22: Gem::Platform::X64_MINGW,
x64_mingw_23: Gem::Platform::X64_MINGW,
x64_mingw_24: Gem::Platform::X64_MINGW,
x64_mingw_25: Gem::Platform::X64_MINGW,
x64_mingw_26: Gem::Platform::X64_MINGW,
x64_mingw_27: Gem::Platform::X64_MINGW,
x64_mingw_30: Gem::Platform::X64_MINGW,
x64_mingw_31: Gem::Platform::X64_MINGW,
x64_mingw_32: Gem::Platform::X64_MINGW,
x64_mingw_33: Gem::Platform::X64_MINGW,
x64_mingw_34: Gem::Platform::X64_MINGW,
x64_mingw_35: Gem::Platform::X64_MINGW }
mingw: Gem::Platform::UNIVERSAL_MINGW,
mingw_18: Gem::Platform::UNIVERSAL_MINGW,
mingw_19: Gem::Platform::UNIVERSAL_MINGW,
mingw_20: Gem::Platform::UNIVERSAL_MINGW,
mingw_21: Gem::Platform::UNIVERSAL_MINGW,
mingw_22: Gem::Platform::UNIVERSAL_MINGW,
mingw_23: Gem::Platform::UNIVERSAL_MINGW,
mingw_24: Gem::Platform::UNIVERSAL_MINGW,
mingw_25: Gem::Platform::UNIVERSAL_MINGW,
mingw_26: Gem::Platform::UNIVERSAL_MINGW,
mingw_27: Gem::Platform::UNIVERSAL_MINGW,
mingw_30: Gem::Platform::UNIVERSAL_MINGW,
mingw_31: Gem::Platform::UNIVERSAL_MINGW,
mingw_32: Gem::Platform::UNIVERSAL_MINGW,
mingw_33: Gem::Platform::UNIVERSAL_MINGW,
mingw_34: Gem::Platform::UNIVERSAL_MINGW,
mingw_35: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_20: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_21: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_22: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_23: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_24: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_25: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_26: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_27: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_30: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_31: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_32: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_33: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_34: Gem::Platform::UNIVERSAL_MINGW,
x64_mingw_35: Gem::Platform::UNIVERSAL_MINGW }
end
# rubocop:enable Naming/VariableNumber

Expand Down
4 changes: 2 additions & 2 deletions bundler/spec/commands/cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
end

context "with --all-platforms" do
it "puts the gems in vendor/cache even for other rubies", bundler: ">= 2.4.0" do
it "puts the gems in vendor/cache even for other rubies" do
gemfile <<-D
source "https://gem.repo1"
gem 'myrack', :platforms => [:ruby_20, :windows_20]
Expand All @@ -221,7 +221,7 @@
expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist
end

it "puts the gems in vendor/cache even for legacy windows rubies", bundler: ">= 2.4.0" do
it "puts the gems in vendor/cache even for legacy windows rubies" do
gemfile <<-D
source "https://gem.repo1"
gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20]
Expand Down
13 changes: 10 additions & 3 deletions bundler/spec/support/filters.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# frozen_string_literal: true

class RequirementChecker < Proc
def self.against(present)
def self.against(present, major_only: false)
present = present.split(".")[0] if major_only
provided = Gem::Version.new(present)

new do |required|
!Gem::Requirement.new(required).satisfied_by?(provided)
requirement = Gem::Requirement.new(required)

if major_only && !requirement.requirements.map(&:last).all? {|version| version.segments.one? }
raise "this filter only supports major versions, but #{required} was given"
end

!requirement.satisfied_by?(provided)
end.tap do |checker|
checker.provided = provided
end
Expand All @@ -21,7 +28,7 @@ def inspect
RSpec.configure do |config|
config.filter_run_excluding realworld: true

config.filter_run_excluding bundler: RequirementChecker.against(Bundler::VERSION.split(".")[0])
config.filter_run_excluding bundler: RequirementChecker.against(Bundler::VERSION, major_only: true)
config.filter_run_excluding rubygems: RequirementChecker.against(Gem::VERSION)
config.filter_run_excluding ruby_repo: !ENV["GEM_COMMAND"].nil?
config.filter_run_excluding no_color_tty: Gem.win_platform? || !ENV["GITHUB_ACTION"].nil?
Expand Down
Loading