naturalsorter 3.0.10 → 3.0.11

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
  SHA1:
3
- metadata.gz: f77ff5a0c7843443a170d17863591648994e8d4e
4
- data.tar.gz: 70345fa0e81a99dc9ac2ebb055a8a3ea08704694
3
+ metadata.gz: b5ef3f2f8651e025ce0853aaa502b530f6b60e97
4
+ data.tar.gz: c802e36cfe0f9ef3796783c69a16e2018611801a
5
5
  SHA512:
6
- metadata.gz: 802d8e6f34de0cd67ef29f176e3c47337c141a9d5945f99bfaf3b69c09307c893f4e52679727240d4dc94628a053a7e825bb1e55430dbfe162e81c2e9eb06b0c
7
- data.tar.gz: c1e51ac23f8fcc923b106d4549dc1b505468491d6ac8c64ad0ea343099a457f42a7fe9847ddb6e7e5a96f43bf73b824309575a1ae5b756e6570fee2a00b81e30
6
+ metadata.gz: 03935e8d1da7c6d459753a72f6ef61b829dabf7bc042b737339ab06fced3d02700950fa6edbed4feb3a6bdf51f712e4ef50d8d2e865fcece142c730a0eb2b382
7
+ data.tar.gz: 0ff45ca12f2a93ef2ce0e1e652a93a7ff6d01400fe3f836949416a1a340c5d7259f4f931bffb8f902b7dc3d0125632621e6e58058db92020cda795feea73a39c
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.10'`
29
+ `gem 'naturalsorter', '3.0.11'`
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.10"
2
+ VERSION = "3.0.11"
3
3
  end
@@ -94,10 +94,10 @@ class VersionTagRecognizer
94
94
  return spliti[1]
95
95
  else
96
96
  return A_STABILITY_DEV if version.match(/\Adev-/i) || version.match(/-dev\z/i)
97
-
97
+
98
98
  if self.stable? version
99
99
  return A_STABILITY_STABLE
100
- elsif self.patch? version
100
+ elsif self.patch? version
101
101
  return A_STABILITY_PATCH
102
102
  elsif self.pre? version
103
103
  return A_STABILITY_PRE
data/lib/versioncmp.rb CHANGED
@@ -108,14 +108,14 @@ class Versioncmp
108
108
  def self.compare_special_cases part1, part2
109
109
  result = Versioncmp.check_jquery_versioning(part1, part2)
110
110
  return result if !result.to_s.strip.empty?
111
-
111
+
112
112
  digit = part1 if part1.match(/\d/)
113
113
  return -1 if ( part1.match(/\d/) && part2.match(/#{digit}\S*patch\S*/) )
114
114
 
115
115
  digit = part2 if part2.match(/\d/)
116
116
  return 1 if ( part2.match(/\d/) && part1.match(/#{digit}\S*patch\S*/) )
117
-
118
- if ( part1.match(/#\S*patch\S*/) && part2.match(/\S*patch\S*/) )
117
+
118
+ if ( part1.match(/#\S*patch\S*/) && part2.match(/\S*patch\S*/) )
119
119
  return compare_string(part1, part2)
120
120
  end
121
121
 
@@ -132,27 +132,27 @@ class Versioncmp
132
132
  pm1 = part1.match(/\A(\d+)-(\w+)\z/i)
133
133
  pm2 = part2.match(/\A\d+\z/i)
134
134
  return 1 if try_to_i_bigger( pm1, pm2, part2 )
135
- return 1 if pm2 && pm1 && pm1[1].eql?(part2) && VersionTagRecognizer.stable?(pm1[2])
135
+ return 1 if pm2 && pm1 && pm1[1].eql?(part2) && VersionTagRecognizer.stable?(pm1[2])
136
136
 
137
137
  pm1 = part1.match(/\A\d+\z/i)
138
138
  pm2 = part2.match(/\A(\d+)-(\w+)\z/i)
139
139
  return 1 if try_to_i_bigger( pm1, pm2, part2 )
140
- return -1 if pm1 && pm2 && pm2[1].eql?(part1) && VersionTagRecognizer.stable?(pm2[2])
140
+ return -1 if pm1 && pm2 && pm2[1].eql?(part1) && VersionTagRecognizer.stable?(pm2[2])
141
141
 
142
142
  return 1 if ( part1.match(/\A[0-9]+\z/) && !part2.match(/\A[0-9]+\z/) )
143
143
 
144
144
  return -1;
145
- rescue => e
146
- p e.message
145
+ rescue => e
146
+ p e.message
147
147
  p e.backtrace.join("\n")
148
- return -1
148
+ return -1
149
149
  end
150
150
 
151
151
 
152
- def self.try_to_i_bigger pm1, pm2, part2
153
- pm2 && pm1 && pm1[1].to_i > part2.to_i
154
- rescue => e
155
- false
152
+ def self.try_to_i_bigger pm1, pm2, part2
153
+ pm2 && pm1 && pm1[1].to_i > part2.to_i
154
+ rescue => e
155
+ false
156
156
  end
157
157
 
158
158
 
@@ -232,7 +232,7 @@ class Versioncmp
232
232
  end
233
233
  end
234
234
 
235
- def self.replace_snapshot val
235
+ def self.replace_snapshot val
236
236
  if val.match(/\-SNAPSHOT/)
237
237
  val.gsub!("-SNAPSHOT", "")
238
238
  end
@@ -261,8 +261,10 @@ class Versioncmp
261
261
 
262
262
  def self.replace_x_dev val
263
263
  new_val = String.new(val)
264
- if val.eql?("dev-master") || val.eql?("dev-develop")
265
- new_val = "9999999"
264
+ if val.eql?("dev-master")
265
+ new_val = "99999999999"
266
+ elsif val.eql?("dev-develop")
267
+ new_val = "9999999999"
266
268
  elsif val.match(/\Adev-/i)
267
269
  new_val = "9999999"
268
270
  elsif val.match(/\.x-dev$/i)
@@ -41,7 +41,7 @@ describe Versioncmp do
41
41
  it "3.5.5 is smaller than 3.5.5-1 " do
42
42
  Versioncmp.compare("3.5.5", "3.5.5-1").should eql(-1)
43
43
  end
44
-
44
+
45
45
  it "2.3.1-b01 is bigger than 2.3.1" do
46
46
  Versioncmp.compare("2.3.1-b01", "2.3.1").should eql(1)
47
47
  end
@@ -54,7 +54,7 @@ describe Versioncmp do
54
54
  Versioncmp.compare("2.3.d-b01", "2.3.1").should eql(-1)
55
55
  end
56
56
 
57
-
57
+
58
58
  it "2.18.1 is bigger than 2.18-20141019" do
59
59
  Versioncmp.compare("2.18.1", "2.18-20141019").should eql(1)
60
60
  end
@@ -232,6 +232,10 @@ describe Versioncmp do
232
232
  Versioncmp.compare("dev-master", "1.0.0").should eql(1)
233
233
  end
234
234
 
235
+ it "dev-master is bigger than dev-support_old" do
236
+ Versioncmp.compare("dev-master", "dev-support_old").should eql(1)
237
+ end
238
+
235
239
  it "dev-develop is bigger than 1.0.0" do
236
240
  Versioncmp.compare("dev-develop", "1.0.0").should eql(1)
237
241
  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.10
4
+ version: 3.0.11
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-07-15 00:00:00.000000000 Z
12
+ date: 2015-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec