semantic_range 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/semantic_range/pre_release.rb +2 -2
- data/lib/semantic_range/version.rb +1 -1
- data/lib/semantic_range.rb +15 -10
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5570448573eca2548f2ce0b071f6202556de21a96c7c3681691f24e919c9fe2d
|
4
|
+
data.tar.gz: 26d2d05d0d10001a0e210eabf5d1e66d192f5f2a97a4435785f0e2d2e4f23920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c8bbe048f7289c9277410e7c09f0f5eab4b202949bff9ef7a696cee493e9bc814b9137ee9677e794df7567d4f0b6646c21cb42780c33a1cb67daafea600e595
|
7
|
+
data.tar.gz: 9d31e3ae5fe35330179bf1e5d3776550aafa82b3dd5468222e9620b22606e52f1ee2198c037f9cdfb061475ceedb1c766f002a1624cf27665b46638d6eba498a
|
data/README.md
CHANGED
@@ -62,7 +62,7 @@ module SemanticRange
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def last_number_index
|
65
|
-
parts.rindex { |e| e.is_a?
|
65
|
+
parts.rindex { |e| e.is_a? Integer }
|
66
66
|
end
|
67
67
|
|
68
68
|
def increment!(identifier = nil)
|
@@ -80,7 +80,7 @@ module SemanticRange
|
|
80
80
|
# 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
81
81
|
# 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
82
82
|
if parts[0] == identifier
|
83
|
-
unless parts[1].kind_of?(
|
83
|
+
unless parts[1].kind_of?(Integer)
|
84
84
|
@parts = [identifier, 0]
|
85
85
|
end
|
86
86
|
else
|
data/lib/semantic_range.rb
CHANGED
@@ -149,6 +149,9 @@ module SemanticRange
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def self.satisfies?(version, range, loose: false, platform: nil)
|
152
|
+
if valid?(range, loose: loose)
|
153
|
+
return version == range
|
154
|
+
end
|
152
155
|
return false if !valid_range(range, loose: loose, platform: platform)
|
153
156
|
Range.new(range, loose: loose, platform: platform).test(version)
|
154
157
|
end
|
@@ -221,6 +224,16 @@ module SemanticRange
|
|
221
224
|
compare(a, b, loose: loose) <= 0
|
222
225
|
end
|
223
226
|
|
227
|
+
def self.valid?(version, loose: false)
|
228
|
+
return false unless version.is_a?(String)
|
229
|
+
|
230
|
+
stripped_version = version.strip
|
231
|
+
return false if stripped_version.length > MAX_LENGTH
|
232
|
+
|
233
|
+
rxp = loose ? LOOSE : FULL
|
234
|
+
return rxp.match?(stripped_version)
|
235
|
+
end
|
236
|
+
|
224
237
|
def self.valid(version, loose: false)
|
225
238
|
v = parse(version, loose: loose)
|
226
239
|
return v ? v.version : nil
|
@@ -233,17 +246,9 @@ module SemanticRange
|
|
233
246
|
|
234
247
|
def self.parse(version, loose: false)
|
235
248
|
return version if version.is_a?(Version)
|
249
|
+
return nil unless valid?(version, loose: loose)
|
236
250
|
|
237
|
-
|
238
|
-
|
239
|
-
stripped_version = version.strip
|
240
|
-
|
241
|
-
return nil if stripped_version.length > MAX_LENGTH
|
242
|
-
|
243
|
-
rxp = loose ? LOOSE : FULL
|
244
|
-
return nil if !rxp.match(stripped_version)
|
245
|
-
|
246
|
-
Version.new(stripped_version, loose: loose)
|
251
|
+
Version.new(version.strip, loose: loose)
|
247
252
|
end
|
248
253
|
|
249
254
|
def self.increment!(version, release, identifier, loose: false)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_range
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.4'
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- andrewnez@gmail.com
|
30
30
|
executables: []
|
@@ -42,7 +42,7 @@ homepage: https://libraries.io/github/librariesio/semantic_range
|
|
42
42
|
licenses:
|
43
43
|
- MIT
|
44
44
|
metadata: {}
|
45
|
-
post_install_message:
|
45
|
+
post_install_message:
|
46
46
|
rdoc_options: []
|
47
47
|
require_paths:
|
48
48
|
- lib
|
@@ -57,8 +57,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
|
-
rubygems_version: 3.
|
61
|
-
signing_key:
|
60
|
+
rubygems_version: 3.5.16
|
61
|
+
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: node-semver rewritten in ruby, for comparison and inclusion of semantic versions
|
64
64
|
and ranges
|