naturalsorter 3.0.26 → 3.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/.DS_Store +0 -0
- data/lib/naturalsorter/version.rb +1 -1
- data/lib/version_tag_recognizer.rb +4 -4
- data/lib/versioncmp.rb +47 -47
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb70054db38c144413c6377ae9baea628e58446b499f6e33ee9324f733c5391a
|
4
|
+
data.tar.gz: d98475af5e41de9fb63d0e75063ab9355fdfe0e4359bed11063047347e5259d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f9e67ae41ed2dfcf070c47019ad909172921ee3b56cae2037446202a4189196a96792fc96ba8d4c5636520fa4ce041dc0863456fde965065465d4c1f280a8a0
|
7
|
+
data.tar.gz: 440e2a3e8b4d4572dcff510c4acd5f44cd96885cf8ed373f10972dcee11d4d73393c73bbbfb26744cfa5beb99ce4bf8c04c0539edd19aa413a0b3df2216abf36
|
data/lib/.DS_Store
ADDED
Binary file
|
@@ -78,7 +78,7 @@ class VersionTagRecognizer
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def self.remove_minimum_stability val
|
81
|
-
val.gsub!(/@.*$/, "") if val.match(/@.*$/)
|
81
|
+
val.gsub!(/@.*$/, "") if val.to_s.match(/@.*$/)
|
82
82
|
end
|
83
83
|
|
84
84
|
|
@@ -142,7 +142,7 @@ class VersionTagRecognizer
|
|
142
142
|
|
143
143
|
def self.stable? value
|
144
144
|
return true if value.to_s.empty?
|
145
|
-
return false if value.to_s.match(/\Adev-/i) || value.match(/-dev\z/i)
|
145
|
+
return false if value.to_s.match(/\Adev-/i) || value.to_s.match(/-dev\z/i)
|
146
146
|
return false if self.preview?( value )
|
147
147
|
|
148
148
|
return true if value.to_s.match(/.+RELEASE.*/i)
|
@@ -153,8 +153,8 @@ class VersionTagRecognizer
|
|
153
153
|
|
154
154
|
!self.alpha?(value) and !self.beta?(value) and
|
155
155
|
!self.dev?(value) and !self.pre?(value) and
|
156
|
-
!self.rc?(value) and !value.match(/.+SEC.*/i) and
|
157
|
-
!self.snapshot?(value) and !value.match(/.+M.+/i) and
|
156
|
+
!self.rc?(value) and !value.to_s.match(/.+SEC.*/i) and
|
157
|
+
!self.snapshot?(value) and !value.to_s.match(/.+M.+/i) and
|
158
158
|
!self.build?(value)
|
159
159
|
end
|
160
160
|
|
data/lib/versioncmp.rb
CHANGED
@@ -33,34 +33,34 @@ class Versioncmp
|
|
33
33
|
b_empty = b_val.to_s.empty?
|
34
34
|
|
35
35
|
return 0 if a_empty && b_empty
|
36
|
-
return 0 if a_val.eql?( b_val )
|
36
|
+
return 0 if a_val.to_s.eql?( b_val.to_s )
|
37
37
|
return 1 if (a_empty == false) && (b_empty == true )
|
38
38
|
return -1 if (b_empty == false) && (a_empty == true )
|
39
39
|
|
40
|
-
return 1 if b_val.length > a_val.length && b_val.match(/\A#{a_val}-SNAPSHOT/i)
|
41
|
-
return -1 if a_val.length > b_val.length && a_val.match(/\A#{a_val}-SNAPSHOT/i)
|
40
|
+
return 1 if b_val.length > a_val.length && b_val.to_s.match(/\A#{a_val}-SNAPSHOT/i)
|
41
|
+
return -1 if a_val.length > b_val.length && a_val.to_s.match(/\A#{a_val}-SNAPSHOT/i)
|
42
42
|
|
43
|
-
return 1 if b_val.length > a_val.length && b_val.match(/\A#{a_val}-BETA.*/i)
|
44
|
-
return -1 if a_val.length > b_val.length && a_val.match(/\A#{a_val}-BETA.*/i)
|
43
|
+
return 1 if b_val.length > a_val.length && b_val.to_s.match(/\A#{a_val}-BETA.*/i)
|
44
|
+
return -1 if a_val.length > b_val.length && a_val.to_s.match(/\A#{a_val}-BETA.*/i)
|
45
45
|
|
46
|
-
return 1 if b_val.length > a_val.length && b_val.match(/\A#{a_val}-alpha.*/i)
|
47
|
-
return -1 if a_val.length > b_val.length && a_val.match(/\A#{a_val}-alpha.*/i)
|
46
|
+
return 1 if b_val.length > a_val.length && b_val.to_s.match(/\A#{a_val}-alpha.*/i)
|
47
|
+
return -1 if a_val.length > b_val.length && a_val.to_s.match(/\A#{a_val}-alpha.*/i)
|
48
48
|
|
49
|
-
return 1 if b_val.length > a_val.length && b_val.match(/\A#{a_val}-rc.*/i)
|
50
|
-
return -1 if a_val.length > b_val.length && a_val.match(/\A#{a_val}-rc.*/i)
|
49
|
+
return 1 if b_val.length > a_val.length && b_val.to_s.match(/\A#{a_val}-rc.*/i)
|
50
|
+
return -1 if a_val.length > b_val.length && a_val.to_s.match(/\A#{a_val}-rc.*/i)
|
51
51
|
|
52
|
-
return -1 if b_val.length > a_val.length && b_val.match(/\A#{a_val}u\d/i)
|
53
|
-
return 1 if a_val.length > b_val.length && a_val.match(/\A#{b_val}u\d/i)
|
52
|
+
return -1 if b_val.length > a_val.length && b_val.to_s.match(/\A#{a_val}u\d/i)
|
53
|
+
return 1 if a_val.length > b_val.length && a_val.to_s.match(/\A#{b_val}u\d/i)
|
54
54
|
|
55
55
|
a = pre_process a_val
|
56
56
|
b = pre_process b_val
|
57
57
|
|
58
|
-
am = a.match(/\A(\d+\.\d+)\.\d+\z/i)
|
59
|
-
bm = b.match(/\A(\d+\.\d+)-\w+\z/i)
|
58
|
+
am = a.to_s.match(/\A(\d+\.\d+)\.\d+\z/i)
|
59
|
+
bm = b.to_s.match(/\A(\d+\.\d+)-\w+\z/i)
|
60
60
|
return 1 if am && bm && am[1].eql?(bm[1])
|
61
61
|
|
62
|
-
am = a.match(/\A(\d+\.\d+)-\w+\z/i)
|
63
|
-
bm = b.match(/\A(\d+\.\d+)\.\d+\z/i)
|
62
|
+
am = a.to_s.match(/\A(\d+\.\d+)-\w+\z/i)
|
63
|
+
bm = b.to_s.match(/\A(\d+\.\d+)\.\d+\z/i)
|
64
64
|
return -1 if am && bm && am[1].eql?(bm[1])
|
65
65
|
|
66
66
|
ab = [a, b]
|
@@ -95,9 +95,9 @@ class Versioncmp
|
|
95
95
|
offsets[0] += part1.length() + 1;
|
96
96
|
offsets[1] += part2.length() + 1;
|
97
97
|
|
98
|
-
if ( part1.match(/^[0-9]+$/) && part2.match(/^[0-9]+$/) )
|
98
|
+
if ( part1.to_s.match(/^[0-9]+$/) && part2.to_s.match(/^[0-9]+$/) )
|
99
99
|
return self.compare_numbers part1, part2
|
100
|
-
elsif ( !part1.match(/^[0-9]+$/) && !part2.match(/^[0-9]+$/) )
|
100
|
+
elsif ( !part1.to_s.match(/^[0-9]+$/) && !part2.to_s.match(/^[0-9]+$/) )
|
101
101
|
return self.compare_strings ab[0], ab[1], part1, part2
|
102
102
|
else
|
103
103
|
return self.compare_special_cases part1, part2
|
@@ -127,33 +127,33 @@ class Versioncmp
|
|
127
127
|
result = Versioncmp.check_jquery_versioning(part1, part2)
|
128
128
|
return result if !result.to_s.strip.empty?
|
129
129
|
|
130
|
-
digit = part1 if part1.match(/\d/)
|
131
|
-
return -1 if ( part1.match(/\d/) && part2.match(/#{digit}\S*patch\S*/) )
|
130
|
+
digit = part1 if part1.to_s.match(/\d/)
|
131
|
+
return -1 if ( part1.to_s.match(/\d/) && part2.to_s.match(/#{digit}\S*patch\S*/) )
|
132
132
|
|
133
|
-
digit = part2 if part2.match(/\d/)
|
134
|
-
return 1 if ( part2.match(/\d/) && part1.match(/#{digit}\S*patch\S*/) )
|
133
|
+
digit = part2 if part2.to_s.match(/\d/)
|
134
|
+
return 1 if ( part2.to_s.match(/\d/) && part1.to_s.match(/#{digit}\S*patch\S*/) )
|
135
135
|
|
136
|
-
if ( part1.match(/#\S*patch\S*/) && part2.match(/\S*patch\S*/) )
|
136
|
+
if ( part1.to_s.match(/#\S*patch\S*/) && part2.to_s.match(/\S*patch\S*/) )
|
137
137
|
return compare_string(part1, part2)
|
138
138
|
end
|
139
139
|
|
140
|
-
return 1 if ( part1.eql?("0") && part2.match(/^[a-zA-Z]+/) )
|
141
|
-
return -1 if ( part2.eql?("0") && part1.match(/^[a-zA-Z]+/) )
|
142
|
-
return -1 if ( part1.eql?("0") && part2.match(/^[1-9]+[-_a-zA-Z]+/) )
|
143
|
-
return 1 if ( part2.eql?("0") && part1.match(/^[1-9]+[-_a-zA-Z]+/) )
|
140
|
+
return 1 if ( part1.eql?("0") && part2.to_s.match(/^[a-zA-Z]+/) )
|
141
|
+
return -1 if ( part2.eql?("0") && part1.to_s.match(/^[a-zA-Z]+/) )
|
142
|
+
return -1 if ( part1.eql?("0") && part2.to_s.match(/^[1-9]+[-_a-zA-Z]+/) )
|
143
|
+
return 1 if ( part2.eql?("0") && part1.to_s.match(/^[1-9]+[-_a-zA-Z]+/) )
|
144
144
|
|
145
|
-
pm1 = part1.match(/\A[0-9]+\z/)
|
146
|
-
pm2 = part2.match(/\A(\d+)(\w+)\z/i)
|
145
|
+
pm1 = part1.to_s.match(/\A[0-9]+\z/)
|
146
|
+
pm2 = part2.to_s.match(/\A(\d+)(\w+)\z/i)
|
147
147
|
return 1 if ( pm1 && pm2 && pm2[1].eql?(part1) && VersionTagRecognizer.stable?(pm2[2]) )
|
148
148
|
return -1 if ( pm1 && pm2 && pm2[1].eql?(part1) && !VersionTagRecognizer.stable?(pm2[2]) )
|
149
149
|
|
150
|
-
pm1 = part1.match(/\A(\d+)-(\w+)\z/i)
|
151
|
-
pm2 = part2.match(/\A\d+\z/i)
|
150
|
+
pm1 = part1.to_s.match(/\A(\d+)-(\w+)\z/i)
|
151
|
+
pm2 = part2.to_s.match(/\A\d+\z/i)
|
152
152
|
return 1 if try_to_i_bigger( pm1, pm2, part2 )
|
153
153
|
return 1 if pm2 && pm1 && pm1[1].eql?(part2) && VersionTagRecognizer.stable?(pm1[2])
|
154
154
|
|
155
|
-
pm1 = part1.match(/\A\d+\z/i)
|
156
|
-
pm2 = part2.match(/\A(\d+)-(\w+)\z/i)
|
155
|
+
pm1 = part1.to_s.match(/\A\d+\z/i)
|
156
|
+
pm2 = part2.to_s.match(/\A(\d+)-(\w+)\z/i)
|
157
157
|
return 1 if try_to_i_bigger( pm1, pm2, part2 )
|
158
158
|
return -1 if pm1 && pm2 && pm2[1].eql?(part1) && VersionTagRecognizer.stable?(pm2[2])
|
159
159
|
|
@@ -211,7 +211,7 @@ class Versioncmp
|
|
211
211
|
break if offsetz > cake.length()
|
212
212
|
|
213
213
|
p = cake[ offset..offset + z ]
|
214
|
-
break if ( p.match(/^\w+\.$/) != nil )
|
214
|
+
break if ( p.to_s.match(/^\w+\.$/) != nil )
|
215
215
|
end
|
216
216
|
|
217
217
|
z = z - 1 if z > 0
|
@@ -222,7 +222,7 @@ class Versioncmp
|
|
222
222
|
|
223
223
|
def self.timestamp? part
|
224
224
|
return false if part.to_s.empty?
|
225
|
-
return part.length() == 9 && part.match(/^[0-9]+$/) != nil
|
225
|
+
return part.length() == 9 && part.to_s.match(/^[0-9]+$/) != nil
|
226
226
|
end
|
227
227
|
|
228
228
|
|
@@ -247,19 +247,19 @@ class Versioncmp
|
|
247
247
|
end
|
248
248
|
|
249
249
|
def self.replace_groovy val
|
250
|
-
if val.match(/\-groovy\-/)
|
250
|
+
if val.to_s.match(/\-groovy\-/)
|
251
251
|
val.gsub!("-groovy-", ".")
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
255
255
|
def self.replace_snapshot val
|
256
|
-
if val.match(/\-SNAPSHOT/)
|
256
|
+
if val.to_s.match(/\-SNAPSHOT/)
|
257
257
|
val.gsub!("-SNAPSHOT", "")
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
261
261
|
def self.replace_redhatx val
|
262
|
-
if val.match(/\-redhat\-[0-9]+$/i)
|
262
|
+
if val.to_s.match(/\-redhat\-[0-9]+$/i)
|
263
263
|
val.gsub!(/\-redhat\-[0-9]+$/i, "")
|
264
264
|
end
|
265
265
|
end
|
@@ -270,9 +270,9 @@ class Versioncmp
|
|
270
270
|
# Ganz grosses Kino !
|
271
271
|
#
|
272
272
|
def self.replace_timestamps val
|
273
|
-
if val.match(/^[0-9]{8}$/)
|
273
|
+
if val.to_s.match(/^[0-9]{8}$/)
|
274
274
|
val.gsub!(/^[0-9]{8}$/, "0.0.0")
|
275
|
-
elsif val.match(/^[0-9]{8}.[0-9]{6}$/)
|
275
|
+
elsif val.to_s.match(/^[0-9]{8}.[0-9]{6}$/)
|
276
276
|
val.gsub!(/^[0-9]{8}.[0-9]{6}$/, "0.0.0")
|
277
277
|
end
|
278
278
|
end
|
@@ -280,7 +280,7 @@ class Versioncmp
|
|
280
280
|
|
281
281
|
def self.replace_wildcards val
|
282
282
|
new_val = String.new(val)
|
283
|
-
new_val = "9999999" if val.match(/\.\*$/)
|
283
|
+
new_val = "9999999" if val.to_s.match(/\.\*$/)
|
284
284
|
new_val
|
285
285
|
end
|
286
286
|
|
@@ -291,11 +291,11 @@ class Versioncmp
|
|
291
291
|
new_val = "99999999999"
|
292
292
|
elsif val.eql?("dev-develop")
|
293
293
|
new_val = "9999999999"
|
294
|
-
elsif val.match(/\Adev-/i)
|
294
|
+
elsif val.to_s.match(/\Adev-/i)
|
295
295
|
new_val = "9999999"
|
296
|
-
elsif val.match(/\.x-dev$/i)
|
296
|
+
elsif val.to_s.match(/\.x-dev$/i)
|
297
297
|
new_val = val.gsub("x-dev", "9999999")
|
298
|
-
elsif val.match(/-dev$/)
|
298
|
+
elsif val.to_s.match(/-dev$/)
|
299
299
|
new_val = val.gsub("-dev", ".9999999")
|
300
300
|
end
|
301
301
|
new_val
|
@@ -303,7 +303,7 @@ class Versioncmp
|
|
303
303
|
|
304
304
|
|
305
305
|
def self.replace_leading_v val
|
306
|
-
val.gsub!(/^v/, "") if val.match(/^v[0-9]+/)
|
306
|
+
val.gsub!(/^v/, "") if val.to_s.match(/^v[0-9]+/)
|
307
307
|
end
|
308
308
|
|
309
309
|
|
@@ -315,7 +315,7 @@ class Versioncmp
|
|
315
315
|
|
316
316
|
def self.check_jquery_versioning(part1, part2)
|
317
317
|
# --- START ---- special case for awesome jquery shitty verison numbers
|
318
|
-
if ( part1.match(/^[0-9]+[a-zA-Z]+[0-9]+$/) != nil && part2.match(/^[0-9]+$/) != nil )
|
318
|
+
if ( part1.to_s.match(/^[0-9]+[a-zA-Z]+[0-9]+$/) != nil && part2.to_s.match(/^[0-9]+$/) != nil )
|
319
319
|
part1_1 = part1.match(/^[0-9]+/)
|
320
320
|
result = Versioncmp.compare_int(part1_1[0], part2)
|
321
321
|
if result != 0
|
@@ -324,8 +324,8 @@ class Versioncmp
|
|
324
324
|
return -1
|
325
325
|
end
|
326
326
|
|
327
|
-
if ( part2.match(/^[0-9]+[a-zA-Z]+[0-9]+$/) != nil && part1.match(/^[0-9]+$/) != nil )
|
328
|
-
part2_1 = part2.match(/^[0-9]+/)
|
327
|
+
if ( part2.to_s.match(/^[0-9]+[a-zA-Z]+[0-9]+$/) != nil && part1.to_s.match(/^[0-9]+$/) != nil )
|
328
|
+
part2_1 = part2.to_s.match(/^[0-9]+/)
|
329
329
|
result = Versioncmp.compare_int(part1, part2_1[0])
|
330
330
|
if result != 0
|
331
331
|
return result
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naturalsorter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- reiz
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- LICENSE
|
72
72
|
- README.markdown
|
73
73
|
- Rakefile
|
74
|
+
- lib/.DS_Store
|
74
75
|
- lib/natcmp.rb
|
75
76
|
- lib/naturalsorter.rb
|
76
77
|
- lib/naturalsorter/version.rb
|