Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

improvement

  • Loading branch information...
commit 13341b0a6f92571c91f129d7b660fb4c0ab7ef48 1 parent 9d1a5bd
reiz authored
2  README.markdown
Source Rendered
@@ -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
2  lib/naturalsorter/version.rb
... ... @@ -1,3 +1,3 @@
1 1 module Naturalsorter
2   - VERSION = "0.3.0"
  2 + VERSION = "0.3.1"
3 3 end
18 lib/versioncmp.rb
@@ -92,20 +92,20 @@ def self.checkForRC(a, b)
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 @@ def self.isJbossorg(a)
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)
12 spec/versioncmp_spec.rb
@@ -42,10 +42,22 @@
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

0 comments on commit 13341b0

Please sign in to comment.
Something went wrong with that request. Please try again.