summaryrefslogtreecommitdiff
path: root/lib/bundler/installer.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-08-22 11:52:51 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-08-23 10:45:57 +0900
commitf69244cee8c01d82e94d38032c82be684f37808a (patch)
tree40dc0819f3a987867788fe1f752f8088ff209004 /lib/bundler/installer.rb
parent4790d0accdb745f9d8e605fd42eab712e4ebf834 (diff)
Merge rubygems/bundler HEAD
Pick from https://github.com/rubygems/rubygems/commit/6b3a5a9ab0453463381a8164efb6298ea9eb776f
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6268
Diffstat (limited to 'lib/bundler/installer.rb')
-rw-r--r--lib/bundler/installer.rb17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index b7b0e36dfd..1b17de5d4e 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -238,19 +238,14 @@ module Bundler
end
def ensure_specs_are_compatible!
- system_ruby = Bundler::RubyVersion.system
- rubygems_version = Bundler.rubygems.version
@definition.specs.each do |spec|
- if required_ruby_version = spec.required_ruby_version
- unless required_ruby_version.satisfied_by?(system_ruby.gem_version)
- raise InstallError, "#{spec.full_name} requires ruby version #{required_ruby_version}, " \
- "which is incompatible with the current version, #{system_ruby}"
- end
+ unless spec.matches_current_ruby?
+ raise InstallError, "#{spec.full_name} requires ruby version #{spec.required_ruby_version}, " \
+ "which is incompatible with the current version, #{Gem.ruby_version}"
end
- next unless required_rubygems_version = spec.required_rubygems_version
- unless required_rubygems_version.satisfied_by?(rubygems_version)
- raise InstallError, "#{spec.full_name} requires rubygems version #{required_rubygems_version}, " \
- "which is incompatible with the current version, #{rubygems_version}"
+ unless spec.matches_current_rubygems?
+ raise InstallError, "#{spec.full_name} requires rubygems version #{spec.required_rubygems_version}, " \
+ "which is incompatible with the current version, #{Gem.rubygems_version}"
end
end
end