From e6bc48eb5ffcfd9f208597fc772c75a7b086b3e2 Mon Sep 17 00:00:00 2001 From: Thomas Drake-Brockman Date: Sun, 14 Dec 2014 23:25:04 +0800 Subject: [PATCH] Added ruby_22? and friends to CurrentRuby. --- lib/bundler/current_ruby.rb | 60 +++++++++++++++++++++++++++++++++++++ lib/bundler/dependency.rb | 1 + man/gemfile.5.ronn | 2 ++ spec/cache/platform_spec.rb | 4 +-- 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index 8d012a03d7e..ca601d111fe 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -23,6 +23,10 @@ def on_21? RUBY_VERSION =~ /^2\.1/ end + def on_22? + RUBY_VERSION =~ /^2\.2/ + end + def ruby? !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev") end @@ -43,6 +47,10 @@ def ruby_21? ruby? && on_21? end + def ruby_22? + ruby? && on_22? + end + def mri? !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby") end @@ -63,6 +71,10 @@ def mri_21? mri? && on_21? end + def mri_22? + mri? && on_22? + end + def rbx? ruby? && defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx" end @@ -87,6 +99,46 @@ def mswin? Bundler::WINDOWS end + def mswin_18? + mswin? && on_18? + end + + def mswin_19? + mswin? && on_19? + end + + def mswin_20? + mswin? && on_20? + end + + def mswin_21? + mswin? && on_21? + end + + def mswin_22? + mswin? && on_22? + end + + def mswin64? + Bundler::WINDOWS && Gem::Platform.local.os == "mswin64" && Gem::Platform.local.cpu == 'x64' + end + + def mswin64_19? + mswin64? && on_19? + end + + def mswin64_20? + mswin64? && on_20? + end + + def mswin64_21? + mswin64? && on_21? + end + + def mswin64_22? + mswin64? && on_22? + end + def mingw? Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != 'x64' end @@ -107,6 +159,10 @@ def mingw_21? mingw? && on_21? end + def mingw_22? + mingw? && on_22? + end + def x64_mingw? Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == 'x64' end @@ -119,5 +175,9 @@ def x64_mingw_21? x64_mingw? && on_21? end + def x64_mingw_22? + x64_mingw? && on_22? + end + end end diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index c0e8f8bf7b2..675e2fb9fe3 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -14,6 +14,7 @@ class Dependency < Gem::Dependency :ruby_19 => Gem::Platform::RUBY, :ruby_20 => Gem::Platform::RUBY, :ruby_21 => Gem::Platform::RUBY, + :ruby_22 => Gem::Platform::RUBY, :mri => Gem::Platform::RUBY, :mri_18 => Gem::Platform::RUBY, :mri_19 => Gem::Platform::RUBY, diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn index ac49f8c08d8..e84c0f5228c 100644 --- a/man/gemfile.5.ronn +++ b/man/gemfile.5.ronn @@ -181,6 +181,8 @@ There are a number of `Gemfile` platforms: _ruby_ `AND` version 2.0 * `ruby_21`: _ruby_ `AND` version 2.1 + * `ruby_22`: + _ruby_ `AND` version 2.2 * `mri`: Same as _ruby_, but not Rubinius * `mri_18`: diff --git a/spec/cache/platform_spec.rb b/spec/cache/platform_spec.rb index 0ced66375f0..0701d5d4fba 100644 --- a/spec/cache/platform_spec.rb +++ b/spec/cache/platform_spec.rb @@ -5,7 +5,7 @@ gemfile <<-G source "file://#{gem_repo1}" - platforms :ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21 do + platforms :ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22 do gem "rack", "1.0.0" end @@ -13,7 +13,7 @@ gem "activesupport", "2.3.5" end - platforms :mri, :mri_18, :mri_19, :mri_20, :mri_21 do + platforms :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22 do gem "activerecord", "2.3.2" end G