Created
December 11, 2019 10:01
-
-
Save FeepingCreature/e40a3f606f8142d07f3e2c87a2f25717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# patch in ^ operator support | |
class Gem::Version | |
def bump_major | |
self.class.new segments[0].succ | |
end | |
end | |
class Gem::Requirement | |
OPS_BEFORE_SEMVER_OPERATOR = OPS | |
__send__ :remove_const, 'OPS' | |
__send__ :remove_const, 'PATTERN_RAW' | |
__send__ :remove_const, 'PATTERN' | |
OPS = OPS_BEFORE_SEMVER_OPERATOR.merge({ | |
"^" => lambda { |v, r| v >= r && v.release < r.bump_major } | |
}).freeze | |
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|" | |
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*".freeze | |
PATTERN = /\A#{PATTERN_RAW}\z/.freeze | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment