serverspec 0.13.5 → 0.13.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,10 +24,48 @@ module Serverspec
24
24
  end
25
25
  end
26
26
 
27
- class Version < Gem::Version
27
+ class Version
28
+ include Comparable
29
+
30
+ attr_reader :epoch, :version
31
+
32
+ def initialize(val)
33
+ matches = val.match(/^(?:(\d+):)?(\d[0-9a-zA-Z.+:~-]*)$/)
34
+ if matches.nil?
35
+ raise ArgumentError, "Malformed version number string #{val}"
36
+ end
37
+ @epoch = matches[1].to_i
38
+ @version = matches[2].to_s
39
+ end
40
+
28
41
  def <=>(other)
29
- other = Gem::Version.new(other) if other.is_a?(String)
30
- super(other)
42
+ other = Version.new(other) if other.is_a?(String)
43
+ rv = @epoch <=> other.epoch
44
+ return rv if rv != 0
45
+
46
+ return ver_array(@version) <=> ver_array(other.version)
47
+ end
48
+
49
+ private
50
+ def ver_array(val)
51
+ val = val.dup
52
+ re = /^(?:(\d+)|(\D+))(.*)$/
53
+ res = []
54
+ while !val.empty?
55
+ matches = val.match(re)
56
+ if matches[1].nil?
57
+ # String
58
+ matches[2].to_s.each_byte do |b|
59
+ res << ((b == 126) ? -2 : b)
60
+ end
61
+ else
62
+ # Digits
63
+ res << matches[1].to_i
64
+ end
65
+ val = matches[3].to_s
66
+ end
67
+ res << -1
68
+ return res
31
69
  end
32
70
  end
33
71
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.13.5"
2
+ VERSION = "0.13.6"
3
3
  end
@@ -106,3 +106,25 @@ describe package('httpd') do
106
106
  its(:version) { should < '2.2.16' }
107
107
  its(:command) { should eq "dpkg-query -f '${Status} ${Version}' -W httpd | sed -n 's/^install ok installed //p'" }
108
108
  end
109
+
110
+ # Debian-style versions
111
+ describe package('httpd') do
112
+ let(:stdout) { "2.2.15-3\n" }
113
+ its(:version) { should eq '2.2.15-3' }
114
+ its(:version) { should > '2.2.15' }
115
+ its(:version) { should < '2.2.16' }
116
+ its(:version) { should < '2.2.15-4' }
117
+ its(:version) { should > '2.2.15-3~bpo70+1' }
118
+ end
119
+
120
+ # With some epoch
121
+ describe package('httpd') do
122
+ let(:stdout) { "3:2.2.15-3~git20120918+ae4569bc\n" }
123
+ its(:version) { should eq '3:2.2.15-3~git20120918+ae4569bc' }
124
+ its(:version) { should > '3:2.2.15-3~git20120912+ae4569bc' }
125
+ its(:version) { should < '3:2.2.15-3' }
126
+ its(:version) { should < '3:2.2.15-3+feature1' }
127
+ its(:version) { should < '4:1.2.15' }
128
+ its(:version) { should > '2:4.2.15' }
129
+ its(:version) { should > '14.2.15' }
130
+ end
@@ -113,5 +113,6 @@ describe package('httpd') do
113
113
  its(:version) { should eq '2.2.15' }
114
114
  its(:version) { should > '2.2.14' }
115
115
  its(:version) { should < '2.2.16' }
116
+ its(:version) { should > '2.2.9' }
116
117
  its(:command) { should eq "rpm -qi httpd | grep Version | awk '{print $3}'" }
117
118
  end
metadata CHANGED
@@ -1,107 +1,122 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
- version: !ruby/object:Gem::Version
4
- version: 0.13.5
3
+ version: !ruby/object:Gem::Version
4
+ hash: 39
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 13
9
+ - 6
10
+ version: 0.13.6
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Gosuke Miyashita
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
- date: 2013-12-17 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-12-18 00:00:00 +09:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
14
22
  name: net-ssh
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: 2.13.0
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
34
33
  type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rspec
35
37
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 59
44
+ segments:
45
+ - 2
46
+ - 13
47
+ - 0
40
48
  version: 2.13.0
41
- - !ruby/object:Gem::Dependency
42
- name: highline
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
49
  type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: highline
49
53
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: specinfra
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: 0.0.14
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
62
63
  type: :runtime
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: specinfra
63
67
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ - 0
77
+ - 14
68
78
  version: 0.0.14
69
- - !ruby/object:Gem::Dependency
79
+ type: :runtime
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
70
82
  name: bundler
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ~>
74
- - !ruby/object:Gem::Version
75
- version: '1.3'
76
- type: :development
77
83
  prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
80
87
  - - ~>
81
- - !ruby/object:Gem::Version
82
- version: '1.3'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
88
+ - !ruby/object:Gem::Version
89
+ hash: 9
90
+ segments:
91
+ - 1
92
+ - 3
93
+ version: "1.3"
90
94
  type: :development
95
+ version_requirements: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ name: rake
91
98
  prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
99
+ requirement: &id006 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ type: :development
109
+ version_requirements: *id006
97
110
  description: RSpec tests for your servers configured by Puppet, Chef or anything else
98
- email:
111
+ email:
99
112
  - gosukenator@gmail.com
100
- executables:
113
+ executables:
101
114
  - serverspec-init
102
115
  extensions: []
116
+
103
117
  extra_rdoc_files: []
104
- files:
118
+
119
+ files:
105
120
  - .gitignore
106
121
  - .travis.yml
107
122
  - Gemfile
@@ -347,31 +362,41 @@ files:
347
362
  - spec/windows/service_spec.rb
348
363
  - spec/windows/user_spec.rb
349
364
  - spec/windows/windows_registry_key_spec.rb
365
+ has_rdoc: true
350
366
  homepage: http://serverspec.org/
351
- licenses:
367
+ licenses:
352
368
  - MIT
353
- metadata: {}
354
369
  post_install_message:
355
370
  rdoc_options: []
356
- require_paths:
371
+
372
+ require_paths:
357
373
  - lib
358
- required_ruby_version: !ruby/object:Gem::Requirement
359
- requirements:
360
- - - '>='
361
- - !ruby/object:Gem::Version
362
- version: '0'
363
- required_rubygems_version: !ruby/object:Gem::Requirement
364
- requirements:
365
- - - '>='
366
- - !ruby/object:Gem::Version
367
- version: '0'
374
+ required_ruby_version: !ruby/object:Gem::Requirement
375
+ none: false
376
+ requirements:
377
+ - - ">="
378
+ - !ruby/object:Gem::Version
379
+ hash: 3
380
+ segments:
381
+ - 0
382
+ version: "0"
383
+ required_rubygems_version: !ruby/object:Gem::Requirement
384
+ none: false
385
+ requirements:
386
+ - - ">="
387
+ - !ruby/object:Gem::Version
388
+ hash: 3
389
+ segments:
390
+ - 0
391
+ version: "0"
368
392
  requirements: []
393
+
369
394
  rubyforge_project:
370
- rubygems_version: 2.0.3
395
+ rubygems_version: 1.6.2
371
396
  signing_key:
372
- specification_version: 4
397
+ specification_version: 3
373
398
  summary: RSpec tests for your servers configured by Puppet, Chef or anything else
374
- test_files:
399
+ test_files:
375
400
  - spec/aix/command_spec.rb
376
401
  - spec/aix/cron_spec.rb
377
402
  - spec/aix/default_gateway_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 38fe820736c3d3acae8f75fa1cabddb397b278bb
4
- data.tar.gz: ca918843932de8e2364444c061f026f164d93c01
5
- SHA512:
6
- metadata.gz: ae52d933b5a378722ee36ad8c3712476392a55db75d0455c741d7149ff867f307d20e05fe05fba3f7bff3a5bc58fca9e1e6e969fac529dcfca290dff17f48ba3
7
- data.tar.gz: c91ff7550585936cd61873e251ad7b2c6acb97df47a299716cea9831bae023273312e6238b8770d946f92ff69708021fe38841b88813e5863a42984bf188ef7e