naturalsorter 0.4.7 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -76,7 +76,7 @@ because '~>1.1' doesn't fit anymore the newest version.
76
76
 
77
77
  You should add this line to your Gemfile
78
78
 
79
- `gem 'naturalsorter', '0.4.7'`
79
+ `gem 'naturalsorter', '0.5.7'`
80
80
 
81
81
  and run this command in your app root directory
82
82
 
data/lib/naturalsorter.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "naturalsorter/version"
2
2
  require "natcmp"
3
3
  require "versioncmp"
4
+ require "release_recognizer"
4
5
 
5
6
  # naturalsorter.rb
6
7
  #
@@ -1,3 +1,3 @@
1
1
  module Naturalsorter
2
- VERSION = "0.4.7"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -0,0 +1,15 @@
1
+ class ReleaseRecognizer
2
+
3
+ def self.release?(value)
4
+ if value.match(/.+RELEASE.*/i) or value.match(/.+BUILD.*/i) or
5
+ value.match(/.+FINAL.*/i) or value.match(/.+SP.*/i) or
6
+ value.match(/.+GA.*/i)
7
+ return true
8
+ end
9
+ !value.match(/.*alpha.*/i) and !value.match(/.*beta.*/i) and
10
+ !value.match(/.+a.*/i) and !value.match(/.+b.*/i) and
11
+ !value.match(/.*dev.*/i) and !value.match(/.*pre.*/i) and
12
+ !value.match(/.*rc.*/i) and !value.match(/.+SEC.*/i)
13
+ end
14
+
15
+ end
@@ -0,0 +1,109 @@
1
+ require "naturalsorter"
2
+
3
+ describe ReleaseRecognizer do
4
+
5
+ it "release? is true" do
6
+ ReleaseRecognizer.release?("1.1").should be_true
7
+ end
8
+
9
+ it "release? is true" do
10
+ ReleaseRecognizer.release?("1.0.0").should be_true
11
+ end
12
+
13
+ it "release? is true" do
14
+ ReleaseRecognizer.release?("1").should be_true
15
+ end
16
+
17
+ it "release? is true" do
18
+ ReleaseRecognizer.release?("3.3.2.GA").should be_true
19
+ end
20
+
21
+ it "release? is true" do
22
+ ReleaseRecognizer.release?("4.1.5.SP1").should be_true
23
+ end
24
+
25
+ it "release? is true" do
26
+ ReleaseRecognizer.release?("3.1.0.RELEASE").should be_true
27
+ end
28
+
29
+ it "release? is true" do
30
+ ReleaseRecognizer.release?("3.2.0.BUILD").should be_true
31
+ end
32
+
33
+ it "release? is true" do
34
+ ReleaseRecognizer.release?("3.2.0buiLd").should be_true
35
+ end
36
+
37
+ it "release? is true" do
38
+ ReleaseRecognizer.release?("3.2.0.Final").should be_true
39
+ end
40
+
41
+ it "release? is true" do
42
+ ReleaseRecognizer.release?("3.2.0FINAL").should be_true
43
+ end
44
+
45
+ it "release? is false" do
46
+ ReleaseRecognizer.release?("1.1.pre").should be_false
47
+ end
48
+
49
+ it "release? is false" do
50
+ ReleaseRecognizer.release?("2.5.6.SEC03").should be_false
51
+ end
52
+
53
+ it "release? is false" do
54
+ ReleaseRecognizer.release?("2.3.8.pre1").should be_false
55
+ end
56
+
57
+ it "release? is false" do
58
+ ReleaseRecognizer.release?("2.3.9.pre").should be_false
59
+ end
60
+
61
+ it "release? is false" do
62
+ ReleaseRecognizer.release?("3.0.0.beta4").should be_false
63
+ end
64
+
65
+ it "release? is false" do
66
+ ReleaseRecognizer.release?("3.0.0.BETA4").should be_false
67
+ end
68
+
69
+ it "release? is false" do
70
+ ReleaseRecognizer.release?("3.0.0.beta").should be_false
71
+ end
72
+
73
+ it "release? is false" do
74
+ ReleaseRecognizer.release?("3.0.0.rc").should be_false
75
+ end
76
+
77
+ it "release? is false" do
78
+ ReleaseRecognizer.release?("3.0.0.rc2").should be_false
79
+ end
80
+
81
+ it "release? is false" do
82
+ ReleaseRecognizer.release?("3.0.0.RC2").should be_false
83
+ end
84
+
85
+ it "release? is false" do
86
+ ReleaseRecognizer.release?("2.0.x-dev").should be_false
87
+ end
88
+
89
+ it "release? is false" do
90
+ ReleaseRecognizer.release?("2.0.x-DEV").should be_false
91
+ end
92
+
93
+ it "release? is false" do
94
+ ReleaseRecognizer.release?("1.8b1").should be_false
95
+ end
96
+
97
+ it "release? is false" do
98
+ ReleaseRecognizer.release?("1.8B1").should be_false
99
+ end
100
+
101
+ it "release? is false" do
102
+ ReleaseRecognizer.release?("1.1.3a").should be_false
103
+ end
104
+
105
+ it "release? is false" do
106
+ ReleaseRecognizer.release?("1.1.3A").should be_false
107
+ end
108
+
109
+ end
metadata CHANGED
@@ -1,40 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: naturalsorter
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.7
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 7
9
+ version: 0.5.7
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - reiz
9
13
  - versioneye
10
14
  autorequire:
11
15
  bindir: bin
12
16
  cert_chain: []
13
- date: 2012-09-12 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-10-04 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
16
22
  name: rspec
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: '2.6'
23
- type: :development
24
23
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
28
26
  - - ~>
29
- - !ruby/object:Gem::Version
30
- version: '2.6'
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 6
31
+ version: "2.6"
32
+ type: :development
33
+ version_requirements: *id001
31
34
  description: This GEM is sorting Arrays in a natural order. a2 < a10
32
- email:
35
+ email:
33
36
  - robert.reiz@gmx.com
34
37
  executables: []
38
+
35
39
  extensions: []
40
+
36
41
  extra_rdoc_files: []
37
- files:
42
+
43
+ files:
38
44
  - .gitignore
39
45
  - Gemfile
40
46
  - README.markdown
@@ -42,34 +48,43 @@ files:
42
48
  - lib/natcmp.rb
43
49
  - lib/naturalsorter.rb
44
50
  - lib/naturalsorter/version.rb
51
+ - lib/release_recognizer.rb
45
52
  - lib/versioncmp.rb
46
53
  - naturalsorter.gemspec
47
54
  - spec/naturalsorter_spec.rb
55
+ - spec/release_recognizer_spec.rb
48
56
  - spec/versioncmp_spec.rb
57
+ has_rdoc: true
49
58
  homepage: https://github.com/versioneye/naturalsorter
50
59
  licenses: []
60
+
51
61
  post_install_message:
52
62
  rdoc_options: []
53
- require_paths:
63
+
64
+ require_paths:
54
65
  - lib
55
- required_ruby_version: !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ! '>='
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
- required_rubygems_version: !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
64
- - - ! '>='
65
- - !ruby/object:Gem::Version
66
- version: '0'
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ segments:
78
+ - 0
79
+ version: "0"
67
80
  requirements: []
81
+
68
82
  rubyforge_project: naturalsorter
69
- rubygems_version: 1.8.24
83
+ rubygems_version: 1.3.6
70
84
  signing_key:
71
85
  specification_version: 3
72
86
  summary: Sorting arrays in natural order
73
- test_files:
87
+ test_files:
74
88
  - spec/naturalsorter_spec.rb
89
+ - spec/release_recognizer_spec.rb
75
90
  - spec/versioncmp_spec.rb