Commit 4ced1fa
committed
(PUP-6373) Make VersionRange comply with Node Semver.
This commit is a complete rewrite of the SemanticPuppet::VersionRange.
The rewrite was necessary to overcome some deficiencies in the current
implementation. The following was broken and is now fixed:
- A range will never include a version with a pre-release identifier
unless the range explicitly appoints a version that also have a
pre-release identifier and the exact same major, minor, and patch
number.
- Tilde ranges alter minor version numbers, even when they include a
pre-release. I.e. '~1.2.3-alpha' becomes '>=1.2.3-alpha <1.3.0', not
'>=1.2.3-alpha <1.2.4'.
- Caret ranges can be parsed according to spec.
- Partial comparative ranges, i.e. '>1', '<=1.2', are parsed according
to spec.
- Multiple ranges separated with ' || ' are parsed according to spec.
The parser will retain the given string representation so that a range can
reproduce it using its #to_s method. The #inspect method produces the
normalized string with lower and upper bounds for each range in a range
set separated by ' || '.
Multiple ranges separated by space are normalized using intersection.
Ranges in a range set separated by ' || ' are merged.1 parent 8fc3afd commit 4ced1fa
4 files changed
Lines changed: 1417 additions & 378 deletions
File tree
- lib/semantic_puppet
- spec/unit/semantic_puppet
0 commit comments