naturalsorter 3.0.21 → 3.0.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab1f05afaca4d011db3ad1d1238b9669c330b48a16bbaa334be0f0b09bd53729
4
- data.tar.gz: 34b3348f206adad23c86044180038c39d849d54bc0c072766b50cf882a4fe685
3
+ metadata.gz: 9537d7c543199b95ae71b0481b04018af4dae7df66615a3e9d61ce2b42123e97
4
+ data.tar.gz: 27a81c712f0993b8a2c60b00b4b6a68af8b87824ba22e2848862a9f7754fbc6f
5
5
  SHA512:
6
- metadata.gz: 635bef8758a11ef53c8c8d876c0ce9e2e3d4326f0c52a4a868004daa4929a9844a98fc93cce882790a24f65b27cd399a5adc8da32879fa559fa0174c3d8fc4f8
7
- data.tar.gz: 4fe4e73b1f4a819711c443e7cbaf259aca84705e869c9dd36985b1baa034ec0ca2eb0be4b25af175fb923bbc897c7ba39273865b2ce8f521e3ae5174f501ad70
6
+ metadata.gz: 9913d031d0bb8d381f0edbe3ad16027a4325a2ab3d9b115d16c8247d8b6bf4fb283a0495e2bd94c7912b22e5d5d5e938373e1b022f6e2e61bd5a489768b8dcac
7
+ data.tar.gz: 9e75702297826a080562a4faefdcd7e255b2444f71bc32693de516575cbf1ee609dda33bb145ab4b805513f55fb8f5264a29ba6d0052f17b3b66f06649f1e653
@@ -27,7 +27,7 @@ Because the default sort method does not recognize the numbers in the string. Th
27
27
 
28
28
  You should add this line to your Gemfile
29
29
 
30
- `gem 'naturalsorter', '3.0.19'`
30
+ `gem 'naturalsorter', '3.0.22'`
31
31
 
32
32
  and run this command in your app root directory
33
33
 
@@ -1,3 +1,3 @@
1
1
  module Naturalsorter
2
- VERSION = "3.0.21"
2
+ VERSION = "3.0.26"
3
3
  end
@@ -110,11 +110,11 @@ class VersionTagRecognizer
110
110
 
111
111
 
112
112
  def self.stability_tag_for( version )
113
- if version.match(/@.*$/)
113
+ if version.to_s.match(/@.*$/)
114
114
  spliti = version.split("@")
115
115
  return spliti[1]
116
116
  else
117
- return A_STABILITY_DEV if version.match(/\Adev-/i) || version.match(/-dev\z/i)
117
+ return A_STABILITY_DEV if version.to_s.match(/\Adev-/i) || version.to_s.match(/-dev\z/i)
118
118
 
119
119
  if self.stable? version
120
120
  return A_STABILITY_STABLE
@@ -141,14 +141,15 @@ class VersionTagRecognizer
141
141
  end
142
142
 
143
143
  def self.stable? value
144
- return false if value.match(/\Adev-/i) || value.match(/-dev\z/i)
144
+ return true if value.to_s.empty?
145
+ return false if value.to_s.match(/\Adev-/i) || value.match(/-dev\z/i)
145
146
  return false if self.preview?( value )
146
147
 
147
- return true if value.match(/.+RELEASE.*/i)
148
- return true if value.match(/.+FINAL.*/i)
149
- return true if value.match(/.+SP.*/i)
150
- return true if value.match(/.+GA.*/i)
151
- return true if value.match(/.*patch.*/i)
148
+ return true if value.to_s.match(/.+RELEASE.*/i)
149
+ return true if value.to_s.match(/.+FINAL.*/i)
150
+ return true if value.to_s.match(/.+SP.*/i)
151
+ return true if value.to_s.match(/.+GA.*/i)
152
+ return true if value.to_s.match(/.*patch.*/i)
152
153
 
153
154
  !self.alpha?(value) and !self.beta?(value) and
154
155
  !self.dev?(value) and !self.pre?(value) and
@@ -158,44 +159,44 @@ class VersionTagRecognizer
158
159
  end
159
160
 
160
161
  def self.patch? value
161
- value.match(/.*patch.*/i)
162
+ value.to_s.match(/.*patch.*/i)
162
163
  end
163
164
 
164
165
  def self.alpha? value
165
166
  return false if self.beta? value
166
- value.match(/.*alpha.*/i) or value.match(/.+a.*/i)
167
+ value.to_s.match(/.*alpha.*/i) or value.to_s.match(/.+a.*/i)
167
168
  end
168
169
 
169
170
  def self.beta? value
170
- value.match(/.*beta.*/i) or value.match(/.+b.*/i)
171
+ value.to_s.match(/.*beta.*/i) or value.to_s.match(/.+b.*/i)
171
172
  end
172
173
 
173
174
  def self.dev? value
174
- value.match(/.*dev.*/i)
175
+ value.to_s.match(/.*dev.*/i)
175
176
  end
176
177
 
177
178
  def self.rc? value
178
- value.match(/.*rc.*/i) || value.match(/.*cr.*/i)
179
+ value.to_s.match(/.*rc.*/i) || value.to_s.match(/.*cr.*/i)
179
180
  end
180
181
 
181
182
  def self.snapshot? value
182
- value.match(/.+SNAPSHOT.*/i)
183
+ value.to_s.match(/.+SNAPSHOT.*/i)
183
184
  end
184
185
 
185
186
  def self.build? value
186
- value.match(/.+build.*/i)
187
+ value.to_s.match(/.+build.*/i)
187
188
  end
188
189
 
189
190
  def self.pre? value
190
- value.match(/.*pre.*$/i)
191
+ value.to_s.match(/.*pre.*$/i)
191
192
  end
192
193
 
193
194
  def self.jbossorg? value
194
- value.match(/.*jbossorg.*$/i)
195
+ value.to_s.match(/.*jbossorg.*$/i)
195
196
  end
196
197
 
197
198
  def self.preview? value
198
- value.match(/-preview\d+-/i) || value.match(/-preview-/i)
199
+ value.to_s.match(/-preview\d+-/i) || value.to_s.match(/-preview-/i)
199
200
  end
200
201
 
201
202
  end
@@ -287,7 +287,7 @@ class Versioncmp
287
287
 
288
288
  def self.replace_x_dev val
289
289
  new_val = String.new(val)
290
- if val.eql?("dev-master")
290
+ if ['dev-master', 'master', 'trunk'].include?( val )
291
291
  new_val = "99999999999"
292
292
  elsif val.eql?("dev-develop")
293
293
  new_val = "9999999999"
@@ -3,6 +3,11 @@ require "naturalsorter"
3
3
 
4
4
  describe VersionTagRecognizer do
5
5
 
6
+ it "release? is true for nil" do
7
+ # if nill we assume the latest stable version.
8
+ expect( VersionTagRecognizer.release?(nil)).to be_truthy
9
+ end
10
+
6
11
  it "release? is true" do
7
12
  expect( VersionTagRecognizer.release?("1.1")).to be_truthy
8
13
  end
@@ -95,6 +95,14 @@ describe Versioncmp do
95
95
  expect( Versioncmp.compare("dev-master", "10.10.999")).to eql(1)
96
96
  end
97
97
 
98
+ it "master is bigger than 10.10.999" do
99
+ expect( Versioncmp.compare("master", "10.10.999")).to eql(1)
100
+ end
101
+
102
+ it "trunk is bigger than 10.10.999" do
103
+ expect( Versioncmp.compare("trunk", "10.10.999")).to eql(1)
104
+ end
105
+
98
106
  it "2.2.x-dev is bigger than 2.2.1" do
99
107
  expect( Versioncmp.compare("2.2.x-dev", "2.2.1")).to eql(1)
100
108
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naturalsorter
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.21
4
+ version: 3.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - reiz
8
8
  - versioneye
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-11 00:00:00.000000000 Z
12
+ date: 2020-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -85,7 +85,7 @@ homepage: https://github.com/versioneye/naturalsorter
85
85
  licenses:
86
86
  - MIT
87
87
  metadata: {}
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubygems_version: 3.0.8
104
- signing_key:
104
+ signing_key:
105
105
  specification_version: 4
106
106
  summary: Sorting arrays in natural order
107
107
  test_files: