semver_dialects 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/semver_dialects/semantic_version/version_parser.rb +22 -12
- data/lib/semver_dialects/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1cb3a87022079c747bcd293b3cd933d77895a57d588d8f8ce2c810c64c6887d
|
4
|
+
data.tar.gz: effb283d7ac372fe8d5f4ca591502587093e46351f14865d2aba2bec9c76bc19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93c31bfb3463782eaf8a2a18c1f37f47a6b5e8963fc4f1be7079a82171182562f6055546a54b6415120d13fec5810b1892be269bfc98ef90efc56bbc17bdd768
|
7
|
+
data.tar.gz: 235385f7356dbc06085b370de6998606771aedcfff40b88ec79578bf1e1ef931cf568d1ab66abb49350075960b129c6a5515d7bb3970d6f4715b3db23dee0fcf
|
@@ -2,19 +2,22 @@ require_relative "version_cut"
|
|
2
2
|
require_relative "version_interval"
|
3
3
|
|
4
4
|
module VersionParser
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
VERSION_SPECIFIER_REGEX = /(?<op>[><=]+) *(?<version>[a-zA-Z0-9\-_\.\*]+)/
|
6
|
+
|
7
|
+
def self.parse(version_constraint)
|
8
|
+
return self.all_versions if version_constraint == "=*"
|
9
|
+
|
10
|
+
interval = self.all_versions
|
11
|
+
|
12
|
+
version_constraint.split(" ").each do |version_specifier|
|
13
|
+
matches = VERSION_SPECIFIER_REGEX.match(version_specifier)
|
14
|
+
|
15
|
+
if matches.nil? || matches.size == 0
|
16
|
+
raise SemverDialects::Error, "could not parse version specifier \"#{version_specifier}\" from version constraint \"#{version_constraint}\""
|
17
|
+
end
|
10
18
|
|
11
|
-
|
12
|
-
|
13
|
-
version_items.each do
|
14
|
-
|version_item|
|
15
|
-
matches = version_item.match /(?<op>[><=]+) *(?<version>[a-zA-Z0-9\-_\.\*]+)/
|
16
|
-
version_string = matches[:version]
|
17
|
-
case matches[:op]
|
19
|
+
op, version_string = matches[:op], matches[:version]
|
20
|
+
case op
|
18
21
|
when ">="
|
19
22
|
new_interval = VersionInterval.new(IntervalType::LEFT_CLOSED | IntervalType::RIGHT_OPEN, VersionCut.new(version_string), AboveAll.new())
|
20
23
|
interval = interval.intersect(new_interval)
|
@@ -32,6 +35,13 @@ module VersionParser
|
|
32
35
|
interval = interval.intersect(new_interval)
|
33
36
|
end
|
34
37
|
end
|
38
|
+
|
35
39
|
interval
|
36
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def self.all_versions
|
45
|
+
VersionInterval.new(IntervalType::LEFT_OPEN | IntervalType::RIGHT_OPEN, BelowAll.new(), AboveAll.new())
|
46
|
+
end
|
37
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semver_dialects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Thome
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-01-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pastel
|