lib/bundler/ruby_version.rb in bundler-2.0.2 vs lib/bundler/ruby_version.rb in bundler-2.1.0.pre.1

- old
+ new

@@ -47,11 +47,11 @@ PATTERN = / ruby\s ([\d.]+) # ruby version (?:p(-?\d+))? # optional patchlevel (?:\s\((\S+)\s(.+)\))? # optional engine info - /xo + /xo.freeze # Returns a RubyVersion from the given string. # @param [String] the version string to match. # @return [RubyVersion,Nil] The version if the string is a valid RubyVersion # description, and nil otherwise. @@ -72,11 +72,11 @@ def host @host ||= [ RbConfig::CONFIG["host_cpu"], RbConfig::CONFIG["host_vendor"], - RbConfig::CONFIG["host_os"] + RbConfig::CONFIG["host_os"], ].join("-") end # Returns a tuple of these things: # [diff, this, other] @@ -100,27 +100,12 @@ def versions_string(versions) Array(versions).join(", ") end def self.system - ruby_engine = if defined?(RUBY_ENGINE) && !RUBY_ENGINE.nil? - RUBY_ENGINE.dup - else - # not defined in ruby 1.8.7 - "ruby" - end - # :sob: mocking RUBY_VERSION breaks stuff on 1.8.7 + ruby_engine = RUBY_ENGINE.dup ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup - ruby_engine_version = case ruby_engine - when "ruby" - ruby_version - when "rbx" - Rubinius::VERSION.dup - when "jruby" - JRUBY_VERSION.dup - else - RUBY_ENGINE_VERSION.dup - end + ruby_engine_version = RUBY_ENGINE_VERSION.dup patchlevel = RUBY_PATCHLEVEL.to_s @ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version) end