naturalsorter 3.0.2 → 3.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c762c987d60b195b0a8a48a7c2a1b17c6de16824
4
- data.tar.gz: ca7b0eab9886f475ca06c3c07a6c74891d37b72c
3
+ metadata.gz: 0057390025a6528368be274f2b63d6bd41e4ec35
4
+ data.tar.gz: 55f9fe1879d27e00d685f1f8fd07f47ef35d9ed1
5
5
  SHA512:
6
- metadata.gz: adafaad2b904c1aa3f56b37831a930251f9fd173f8019a221d58860adf3e38d6dda4b92a59edf5f1a9ed44e20aa35d2c9c2883d4f829d9f0d7ac088b7a4ab597
7
- data.tar.gz: 7fe82852f1cdf428b8bf3fab7692abed35aec1fa7560ccaabf48969d86f40176ab6f52ad24116f9b275964eeb9db22c1bf1d764520c090cdedf63bff0a71c3fe
6
+ metadata.gz: dfebbedb80998e35e945bfa1d9b955fe6abfdf11749ac6c20c02616814081d4d4cb309fdd0eb367e6775cfeba1df0a17de757d0ab977c94639dc44b1caa04772
7
+ data.tar.gz: e5f31f6da7fdfc773aead02b3b5c5b8864c5ee8b3eea6fc29b33941caba5b8be5088f51ca9f9ea610df4abe654526b212126ba92b0bbc8d324caef54e31689d3
data/README.markdown CHANGED
@@ -26,7 +26,7 @@ Because the default sort method does not recognize the numbers in the string. Th
26
26
 
27
27
  You should add this line to your Gemfile
28
28
 
29
- `gem 'naturalsorter', '3.0.2'`
29
+ `gem 'naturalsorter', '3.0.3'`
30
30
 
31
31
  and run this command in your app root directory
32
32
 
@@ -1,3 +1,3 @@
1
1
  module Naturalsorter
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
3
3
  end
@@ -8,6 +8,8 @@ class VersionTagRecognizer
8
8
  A_STABILITY_SNAPSHOT = "SNAPSHOT"
9
9
  A_STABILITY_DEV = "dev"
10
10
  A_STABILITY_BUILD = "BUILD"
11
+ A_STABILITY_PATCH = "patch"
12
+
11
13
 
12
14
  def self.value_for( value )
13
15
  return 0 if self.dev? value
@@ -17,6 +19,7 @@ class VersionTagRecognizer
17
19
  return 5 if self.rc? value
18
20
  return 6 if self.pre? value
19
21
  return 10 if self.stable? value
22
+ return 11 if self.patch? value
20
23
  return 1
21
24
  end
22
25
 
@@ -87,6 +90,8 @@ class VersionTagRecognizer
87
90
  else
88
91
  if self.stable? version
89
92
  return A_STABILITY_STABLE
93
+ elsif self.patch? version
94
+ return A_STABILITY_PATCH
90
95
  elsif self.pre? version
91
96
  return A_STABILITY_PRE
92
97
  elsif self.rc? version
@@ -112,6 +117,7 @@ class VersionTagRecognizer
112
117
  return true if value.match(/.+FINAL.*/i)
113
118
  return true if value.match(/.+SP.*/i)
114
119
  return true if value.match(/.+GA.*/i)
120
+ return true if value.match(/.+patch.*/i)
115
121
 
116
122
  !self.alpha?(value) and !self.beta?(value) and
117
123
  !self.dev?(value) and !self.pre?(value) and
@@ -120,6 +126,10 @@ class VersionTagRecognizer
120
126
  !self.build?(value)
121
127
  end
122
128
 
129
+ def self.patch? value
130
+ value.match(/.*patch.*/i)
131
+ end
132
+
123
133
  def self.alpha? value
124
134
  return false if self.beta? value
125
135
  value.match(/.*alpha.*/i) or value.match(/.+a.*/i)
@@ -12,6 +12,9 @@ describe Naturalsorter::Sorter do
12
12
  it "c400b5a1 is a1b5c400" do
13
13
  Naturalsorter::Sorter.sort(["a400", "a5", "a1"], true).should eql(["a1", "a5", "a400"])
14
14
  end
15
+ it "cba is abc" do
16
+ Naturalsorter::Sorter.sort(["1.5.2", "1.4.4", "1.5.2-patch"], true).should eql(["1.4.4", "1.5.2", "1.5.2-patch"])
17
+ end
15
18
  end
16
19
  describe "sort_desc" do
17
20
  it "cba is abc" do
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.2
4
+ version: 3.0.3
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: 2015-03-15 00:00:00.000000000 Z
12
+ date: 2015-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project: naturalsorter
73
- rubygems_version: 2.4.6
73
+ rubygems_version: 2.4.3
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Sorting arrays in natural order