lib/bundler/ruby_version.rb in bundler-2.5.18 vs lib/bundler/ruby_version.rb in bundler-2.5.19
- old
+ new
@@ -21,10 +21,16 @@
# * If the engine is "ruby", the engine version
# must not be specified, or the engine version
# specified must match the version.
@versions = Array(versions).map do |v|
- op, v = Gem::Requirement.parse(normalize_version(v))
+ normalized_v = normalize_version(v)
+
+ unless Gem::Requirement::PATTERN.match?(normalized_v)
+ raise InvalidArgumentError, "#{v} is not a valid requirement on the Ruby version"
+ end
+
+ op, v = Gem::Requirement.parse(normalized_v)
op == "=" ? v.to_s : "#{op} #{v}"
end
@gem_version = Gem::Requirement.create(@versions.first).requirements.first.last
@input_engine = engine&.to_s