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 CHANGED
@@ -49,7 +49,7 @@ Get newest.
49
49
 
50
50
  You should add this line to your Gemfile
51
51
 
52
- `gem 'naturalsorter', '0.3.0'`
52
+ `gem 'naturalsorter', '0.3.1'`
53
53
 
54
54
  and run this command in your app root directory
55
55
 
@@ -1,3 +1,3 @@
1
1
  module Naturalsorter
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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[1-9]*$/i, "")
96
- bigwithoutBeta = bigwithoutBeta.gsub(/\-beta[1-9]*$/i, "")
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[1-9]*$/i, "")
102
- bigwithoutAlpha = bigwithoutAlpha.gsub(/\-alpha[1-9]*$/i, "")
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[1-9]*$/i, "")
108
- bigwithoutPre = bigwithoutPre.gsub(/\-pre[1-9]*$/i, "")
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[1-9]*$/i) != nil;
133
+ return a.match(/.*beta.*$/i) != nil;
134
134
  end
135
135
 
136
136
  def self.isAlpha(a)
137
- return a.match(/.*alpha[1-9]*$/i) != nil;
137
+ return a.match(/.*alpha.*$/i) != nil;
138
138
  end
139
139
 
140
140
  def self.isPre(a)
141
- return a.match(/.*pre[1-9]*$/i) != nil;
141
+ return a.match(/.*pre.*$/i) != nil;
142
142
  end
143
143
 
144
144
  def self.getAPiece(offset, cake)
@@ -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.0
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: &70191723925940 !ruby/object:Gem::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: *70191723925940
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