naturalsorter 3.0.20 → 3.0.21

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: 882f355aed3f92457ee271ed1b6e8d411362356533559153f4f0bb8ca223ae57
4
- data.tar.gz: 7fb4a30607b686aa832f9c4b3ff39da32962aa0cdc995c75e66b97a7d07ad06a
3
+ metadata.gz: ab1f05afaca4d011db3ad1d1238b9669c330b48a16bbaa334be0f0b09bd53729
4
+ data.tar.gz: 34b3348f206adad23c86044180038c39d849d54bc0c072766b50cf882a4fe685
5
5
  SHA512:
6
- metadata.gz: 8d667855051e443833abecc71b4f40292584c58a81f07e53196448380d138dedc468a23d6f2c987fd2061458f9acf7cca4a869c12cc137abe57f52d42e28dc75
7
- data.tar.gz: 8822a77b8a5797f9d0819da08aafbd7aa407f54b2daef5f5010227fc4e7b8770ff60a9e289a2dfe8af75cf7bebd67a0197327b4fb4fb1b55e932103353fdb814
6
+ metadata.gz: 635bef8758a11ef53c8c8d876c0ce9e2e3d4326f0c52a4a868004daa4929a9844a98fc93cce882790a24f65b27cd399a5adc8da32879fa559fa0174c3d8fc4f8
7
+ data.tar.gz: 4fe4e73b1f4a819711c443e7cbaf259aca84705e869c9dd36985b1baa034ec0ca2eb0be4b25af175fb923bbc897c7ba39273865b2ce8f521e3ae5174f501ad70
@@ -1,3 +1,3 @@
1
1
  module Naturalsorter
2
- VERSION = "3.0.20"
2
+ VERSION = "3.0.21"
3
3
  end
@@ -24,12 +24,24 @@ class VersionTagRecognizer
24
24
  return 1
25
25
  end
26
26
 
27
+ def self.value_for_key( value )
28
+ return 0 if A_STABILITY_DEV.eql? value
29
+ return 2 if A_STABILITY_SNAPSHOT.eql? value
30
+ return 3 if A_STABILITY_ALPHA.eql? value
31
+ return 4 if A_STABILITY_BETA.eql? value
32
+ return 5 if A_STABILITY_RC.eql? value
33
+ return 6 if A_STABILITY_PRE.eql? value
34
+ return 10 if A_STABILITY_STABLE.eql? value
35
+ return 11 if A_STABILITY_PATCH.eql? value
36
+ return 1
37
+ end
38
+
27
39
  def self.compare_tags( a, b)
28
40
  a_val = self.value_for a
29
41
  b_val = self.value_for b
30
42
  return -1 if a_val < b_val
31
43
  return 1 if a_val > b_val
32
- return 0
44
+ return 0
33
45
  end
34
46
 
35
47
  def self.tagged? value
@@ -297,6 +297,31 @@ describe VersionTagRecognizer do
297
297
  end
298
298
 
299
299
 
300
+ it "returns the right value for stable" do
301
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_STABLE)).to eql(10)
302
+ end
303
+ it "returns the right value for patch" do
304
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_PATCH)).to eql(11)
305
+ end
306
+ it "returns the right value for pre" do
307
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_PRE)).to eql(6)
308
+ end
309
+ it "returns the right value for rc" do
310
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_RC)).to eql(5)
311
+ end
312
+ it "returns the right value for beta" do
313
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_BETA)).to eql(4)
314
+ end
315
+ it "returns the right value for alpha" do
316
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_ALPHA)).to eql(3)
317
+ end
318
+ it "returns the right value for snapshot" do
319
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_SNAPSHOT)).to eql(2)
320
+ end
321
+ it "returns the right value for dev" do
322
+ expect( VersionTagRecognizer.value_for_key(VersionTagRecognizer::A_STABILITY_DEV)).to eql(0)
323
+ end
324
+
300
325
 
301
326
  it "returns compares right for alpha and beta" do
302
327
  expect( VersionTagRecognizer.compare_tags("1.1.1-alpha", "1.1.1-beta")).to eql(-1)
@@ -334,6 +359,9 @@ describe VersionTagRecognizer do
334
359
  it "does fit stability" do
335
360
  expect( VersionTagRecognizer.does_it_fit_stability?( "2.2.1-BETA", "beta" )).to be_truthy
336
361
  end
362
+ it "does fit stability" do
363
+ expect( VersionTagRecognizer.does_it_fit_stability?( "2.2.1-alpha", "beta" )).to be_falsey
364
+ end
337
365
  it "does fit stability" do
338
366
  expect( VersionTagRecognizer.does_it_fit_stability?( "2.2.x-dev", "dev" )).to be_truthy
339
367
  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.20
4
+ version: 3.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - reiz