-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide impl of matchesSemVer #125
Comments
Oh, I see. Yeah that seems like a good method to add. I'll take care of it. |
Close #125 - Add SemVerMatchers, SemVer.matches and SemVer.unsafeMatches
@da-tubi OK, it's done. I still need to clean up little bit but I think I can release it soon. It took me quite a while to write tests. It works similar to sbt's but not the same. How the matcher combination is evaluated might be the same I think.
SemVer.parseUnsafe("2.13.0").unsafeMatches(">=2.13.0") // true
SemVer.parseUnsafe("2.13.0").unsafeMatches(">2.13.0") // false
SemVer.parseUnsafe("2.13.0").unsafeMatches(">=2.13.0") // true
SemVer.parseUnsafe("2.12.0").unsafeMatches("2.12.0 - 2.13.0") // true
SemVer.parseUnsafe("2.13.0").unsafeMatches("2.12.0 - 2.13.0") // true
SemVer.parseUnsafe("2.13.1").unsafeMatches("2.12.0 - 2.13.0") // false
SemVer.parseUnsafe("2.12.0").unsafeMatches(">=2.12.0 <2.14.0") // true
SemVer.parseUnsafe("2.13.0").unsafeMatches(">=2.12.0 <2.14.0") // true
SemVer.parseUnsafe("2.13.8").unsafeMatches(">=2.12.0 <2.14.0") // true
SemVer.parseUnsafe("2.11.0").unsafeMatches("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0") // true
SemVer.parseUnsafe("2.12.9").unsafeMatches("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0") // false
SemVer.parseUnsafe("2.12.8").unsafeMatches("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0") // true
SemVer.parseUnsafe("2.13.0").unsafeMatches("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0") // true
SemVer.parseUnsafe("3.0.0").unsafeMatches("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0") // true
SemVer.parseUnsafe("3.1.0").unsafeMatches("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0") // false NOTE: FYI, Safe matches ( SemVer.parseUnsafe("2.13.0").matches(SemVerMatchers.unsafeParse("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0")) Or a completely safe way would be val matchers =
SemVerMatchers.parse("2.11.0 - 2.12.8 || >=2.13.0 <3.1.0") // Either[List[SemVerMatcher.ParseError], SemVerMatchers]
.left.map(_.map(_.render).mkString(",")) // Either[String, SemVerMatchers]
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I'll do something about it.
SemVer.parse("3.1.0") // Either[ParseError, SemVer]
.left.map(_.render) // Either[String, SemVer]
.flatMap { v =>
matchers.map(v.matches) // Either[String, Boolean]
} // Either[String, Boolean] |
Task
Summary
See ThoughtWorksInc/enableIf.scala#72
We need a zero-dependency SemVer parsing and comparing library in enableIf.scala.
It would be nice to maintain the impl of matchesSemVer (from sbt) in just-semver.
Project Details
Version: latest
Description
The text was updated successfully, but these errors were encountered: