naturalsorter 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/lib/naturalsorter/version.rb +1 -1
- data/lib/versioncmp.rb +9 -9
- data/spec/versioncmp_spec.rb +12 -0
- metadata +3 -3
data/README.markdown
CHANGED
data/lib/versioncmp.rb
CHANGED
@@ -92,20 +92,20 @@ class Versioncmp
|
|
92
92
|
return Versioncmp.getRcValue(a, b)
|
93
93
|
end
|
94
94
|
elsif (Versioncmp.isBeta(big))
|
95
|
-
bigwithoutBeta = big.gsub(/\.beta
|
96
|
-
bigwithoutBeta = bigwithoutBeta.gsub(/\-beta
|
95
|
+
bigwithoutBeta = big.gsub(/\.beta.*$/i, "")
|
96
|
+
bigwithoutBeta = bigwithoutBeta.gsub(/\-beta.*$/i, "")
|
97
97
|
if (Versioncmp.compareString(bigwithoutBeta, small) == 0)
|
98
98
|
return Versioncmp.getRcValue(a, b)
|
99
99
|
end
|
100
100
|
elsif (Versioncmp.isAlpha(big))
|
101
|
-
bigwithoutAlpha = big.gsub(/\.alpha
|
102
|
-
bigwithoutAlpha = bigwithoutAlpha.gsub(/\-alpha
|
101
|
+
bigwithoutAlpha = big.gsub(/\.alpha.*$/i, "")
|
102
|
+
bigwithoutAlpha = bigwithoutAlpha.gsub(/\-alpha.*$/i, "")
|
103
103
|
if (Versioncmp.compareString(bigwithoutAlpha, small) == 0)
|
104
104
|
return Versioncmp.getRcValue(a, b)
|
105
105
|
end
|
106
106
|
elsif (Versioncmp.isPre(big))
|
107
|
-
bigwithoutPre = big.gsub(/\.pre
|
108
|
-
bigwithoutPre = bigwithoutPre.gsub(/\-pre
|
107
|
+
bigwithoutPre = big.gsub(/\.pre.*$/i, "")
|
108
|
+
bigwithoutPre = bigwithoutPre.gsub(/\-pre.*$/i, "")
|
109
109
|
if (Versioncmp.compareString(bigwithoutPre, small) == 0)
|
110
110
|
return Versioncmp.getRcValue(a, b)
|
111
111
|
end
|
@@ -130,15 +130,15 @@ class Versioncmp
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def self.isBeta(a)
|
133
|
-
return a.match(/.*beta
|
133
|
+
return a.match(/.*beta.*$/i) != nil;
|
134
134
|
end
|
135
135
|
|
136
136
|
def self.isAlpha(a)
|
137
|
-
return a.match(/.*alpha
|
137
|
+
return a.match(/.*alpha.*$/i) != nil;
|
138
138
|
end
|
139
139
|
|
140
140
|
def self.isPre(a)
|
141
|
-
return a.match(/.*pre
|
141
|
+
return a.match(/.*pre.*$/i) != nil;
|
142
142
|
end
|
143
143
|
|
144
144
|
def self.getAPiece(offset, cake)
|
data/spec/versioncmp_spec.rb
CHANGED
@@ -42,10 +42,22 @@ describe Versioncmp do
|
|
42
42
|
Versioncmp.compare("1.1-alpha1", "1.1").should eql(-1)
|
43
43
|
end
|
44
44
|
|
45
|
+
it "smaller alpha-1" do
|
46
|
+
Versioncmp.compare("1.1-alpha-1", "1.1").should eql(-1)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "smaller alpha" do
|
50
|
+
Versioncmp.compare("1.1", "1.1-alpha-1").should eql(1)
|
51
|
+
end
|
52
|
+
|
45
53
|
it "smaller beta" do
|
46
54
|
Versioncmp.compare("3.1-beta1", "3.1").should eql(-1)
|
47
55
|
end
|
48
56
|
|
57
|
+
it "smaller beta" do
|
58
|
+
Versioncmp.compare("3.1-beta-1", "3.1").should eql(-1)
|
59
|
+
end
|
60
|
+
|
49
61
|
it "smaller 3.0-rc4-negotiate" do
|
50
62
|
Versioncmp.compare("3.0-rc4-negotiate", "3.0").should eql(-1)
|
51
63
|
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: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-06 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70217385346580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '2.6'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70217385346580
|
25
25
|
description: This GEM is sorting Arrays in a natural order. a2 < a10
|
26
26
|
email:
|
27
27
|
- robert.reiz@gmx.com
|