naturalsorter 3.0.27 → 3.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +0 -2
- data/lib/naturalsorter/version.rb +1 -1
- data/lib/naturalsorter.rb +7 -5
- data/lib/version_tag_recognizer.rb +1 -1
- data/spec/naturalsorter/version_tag_recognizer_spec.rb +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2e74c8afd80ac74a50b5512b063bb9787061a4d921220958e6b4fe4cc50b5a6
|
4
|
+
data.tar.gz: 852db30bdd5503eb99ba0e1a8a6734f2291793a81f0b588aa107345e09f6bf6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ae502c169639242eea60fb9e14add9d3242cf2fc66b1df948d0b1b00cdead5c9d53d954bc7a650fb970f87c4568d362490e168a593aad2c2a33421650b4622f
|
7
|
+
data.tar.gz: 7b08f71ad042cc08cad72166e59d9aa4ca6cc8ab03e4e8df891f14654f56966dc45e08ba15a77bdf57e018c8b10dcce74553d03ce267d17904751c4b6481bec8
|
data/README.markdown
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
# NaturalSorter
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/naturalsorter)
|
4
|
-
[](https://www.versioneye.com/ruby/naturalsorter)
|
5
4
|
[](https://travis-ci.org/versioneye/naturalsorter)
|
6
5
|
[](https://coveralls.io/github/versioneye/naturalsorter?branch=master)
|
7
6
|
[](https://codeclimate.com/github/versioneye/naturalsorter)
|
8
|
-
[](https://www.bountysource.com/trackers/157523-versioneye-naturalsorter?utm_source=157523&utm_medium=shield&utm_campaign=TRACKER_BADGE)
|
9
7
|
|
10
8
|
|
11
9
|
## The Mission
|
data/lib/naturalsorter.rb
CHANGED
@@ -51,10 +51,12 @@ module Naturalsorter
|
|
51
51
|
end
|
52
52
|
|
53
53
|
|
54
|
-
def self.sort_version_by_method(array, method, asc = true )
|
55
|
-
return array if (array.nil? || array.empty? || array.length
|
56
|
-
return array
|
57
|
-
return array
|
54
|
+
def self.sort_version_by_method( array, method, asc = true )
|
55
|
+
return array if (array.nil? || array.empty? || array.length < 1 || method.to_s.strip.empty? )
|
56
|
+
return array if (array[0].nil? || array[1].nil?)
|
57
|
+
return array if (array[0].send(method).nil? || array[1].send(method).nil?)
|
58
|
+
return array&.sort { |a,b| Versioncmp.compare(a.send(method), b.send(method)) } if asc
|
59
|
+
return array&.sort { |a,b| Versioncmp.compare(b.send(method), a.send(method)) }
|
58
60
|
end
|
59
61
|
|
60
62
|
|
@@ -118,7 +120,7 @@ module Naturalsorter
|
|
118
120
|
(0..min_length).each do |z|
|
119
121
|
ver = versions[z]
|
120
122
|
cur = newests[z]
|
121
|
-
if
|
123
|
+
if cur > ver
|
122
124
|
return false
|
123
125
|
end
|
124
126
|
end
|
@@ -349,6 +349,9 @@ describe VersionTagRecognizer do
|
|
349
349
|
it "does fit stability" do
|
350
350
|
expect( VersionTagRecognizer.does_it_fit_stability?( "2.2.1", "stable" )).to be_truthy
|
351
351
|
end
|
352
|
+
it "does not fit stability" do
|
353
|
+
expect( VersionTagRecognizer.does_it_fit_stability?( "3.9.2-insiders.20200509", "stable" )).to be_falsey
|
354
|
+
end
|
352
355
|
it "does not fit stability" do
|
353
356
|
expect( VersionTagRecognizer.does_it_fit_stability?( "2.2.1-BETA", "stable" )).to be_falsey
|
354
357
|
end
|
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.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- reiz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
104
|
+
rubygems_version: 3.3.6
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: Sorting arrays in natural order
|