naturalsorter 0.5.9 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +1 -1
- data/lib/naturalsorter/version.rb +1 -1
- data/lib/versioncmp.rb +14 -4
- data/spec/versioncmp_spec.rb +4 -0
- metadata +37 -49
data/README.markdown
CHANGED
data/lib/versioncmp.rb
CHANGED
|
@@ -26,20 +26,30 @@
|
|
|
26
26
|
class Versioncmp
|
|
27
27
|
|
|
28
28
|
# 'Natural version order' comparison of two version strings
|
|
29
|
-
def self.compare(
|
|
29
|
+
def self.compare(a_val, b_val)
|
|
30
30
|
|
|
31
|
-
if (!
|
|
31
|
+
if (!a_val.nil? || a_val.eql?("") ) && b_val.nil?
|
|
32
32
|
return 1
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
if (!
|
|
35
|
+
if (!b_val.nil? || b_val.eql?("")) && a_val.nil?
|
|
36
36
|
return -1
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
if
|
|
39
|
+
if a_val.nil? && b_val.nil?
|
|
40
40
|
return -1
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
a = String.new(a_val)
|
|
44
|
+
if a_val.match(/\.x-dev$/)
|
|
45
|
+
a = a_val.gsub("x-dev", "9999999")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
b = String.new(b_val)
|
|
49
|
+
if b_val.match(/\.x-dev$/)
|
|
50
|
+
b = b_val.gsub("x-dev", "9999999")
|
|
51
|
+
end
|
|
52
|
+
|
|
43
53
|
offset1 = 0;
|
|
44
54
|
offset2 = 0;
|
|
45
55
|
|
data/spec/versioncmp_spec.rb
CHANGED
metadata
CHANGED
|
@@ -1,46 +1,40 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: naturalsorter
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- 0
|
|
7
|
-
- 5
|
|
8
|
-
- 9
|
|
9
|
-
version: 0.5.9
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.10
|
|
5
|
+
prerelease:
|
|
10
6
|
platform: ruby
|
|
11
|
-
authors:
|
|
7
|
+
authors:
|
|
12
8
|
- reiz
|
|
13
9
|
- versioneye
|
|
14
10
|
autorequire:
|
|
15
11
|
bindir: bin
|
|
16
12
|
cert_chain: []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dependencies:
|
|
21
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
22
16
|
name: rspec
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
requirements:
|
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
|
+
none: false
|
|
19
|
+
requirements:
|
|
26
20
|
- - ~>
|
|
27
|
-
- !ruby/object:Gem::Version
|
|
28
|
-
|
|
29
|
-
- 2
|
|
30
|
-
- 6
|
|
31
|
-
version: "2.6"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '2.6'
|
|
32
23
|
type: :development
|
|
33
|
-
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
none: false
|
|
27
|
+
requirements:
|
|
28
|
+
- - ~>
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
version: '2.6'
|
|
34
31
|
description: This GEM is sorting Arrays in a natural order. a2 < a10
|
|
35
|
-
email:
|
|
32
|
+
email:
|
|
36
33
|
- robert.reiz@gmx.com
|
|
37
34
|
executables: []
|
|
38
|
-
|
|
39
35
|
extensions: []
|
|
40
|
-
|
|
41
36
|
extra_rdoc_files: []
|
|
42
|
-
|
|
43
|
-
files:
|
|
37
|
+
files:
|
|
44
38
|
- .gitignore
|
|
45
39
|
- Gemfile
|
|
46
40
|
- README.markdown
|
|
@@ -54,37 +48,31 @@ files:
|
|
|
54
48
|
- spec/naturalsorter_spec.rb
|
|
55
49
|
- spec/release_recognizer_spec.rb
|
|
56
50
|
- spec/versioncmp_spec.rb
|
|
57
|
-
has_rdoc: true
|
|
58
51
|
homepage: https://github.com/versioneye/naturalsorter
|
|
59
52
|
licenses: []
|
|
60
|
-
|
|
61
53
|
post_install_message:
|
|
62
54
|
rdoc_options: []
|
|
63
|
-
|
|
64
|
-
require_paths:
|
|
55
|
+
require_paths:
|
|
65
56
|
- lib
|
|
66
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
requirements:
|
|
75
|
-
- -
|
|
76
|
-
- !ruby/object:Gem::Version
|
|
77
|
-
|
|
78
|
-
- 0
|
|
79
|
-
version: "0"
|
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
59
|
+
requirements:
|
|
60
|
+
- - ! '>='
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
|
+
none: false
|
|
65
|
+
requirements:
|
|
66
|
+
- - ! '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
80
69
|
requirements: []
|
|
81
|
-
|
|
82
70
|
rubyforge_project: naturalsorter
|
|
83
|
-
rubygems_version: 1.
|
|
71
|
+
rubygems_version: 1.8.24
|
|
84
72
|
signing_key:
|
|
85
73
|
specification_version: 3
|
|
86
74
|
summary: Sorting arrays in natural order
|
|
87
|
-
test_files:
|
|
75
|
+
test_files:
|
|
88
76
|
- spec/naturalsorter_spec.rb
|
|
89
77
|
- spec/release_recognizer_spec.rb
|
|
90
78
|
- spec/versioncmp_spec.rb
|