serverspec 0.2.28 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ require 'singleton'
2
+
3
+ module Serverspec
4
+ class Attributes
5
+ include Singleton
6
+ def initialize
7
+ @attr = {}
8
+ end
9
+ def attributes attr=nil
10
+ if ! attr.nil?
11
+ @attr = attr
12
+ end
13
+ @attr
14
+ end
15
+ end
16
+ end
17
+
@@ -5,6 +5,10 @@ module Serverspec
5
5
  class Darwin < Base
6
6
  class NotImplementedError < Exception; end
7
7
 
8
+ def check_file_md5checksum file, expected
9
+ "openssl md5 #{escape(file)} | cut -d'=' -f2 | cut -c 2- | grep -E ^#{escape(expected)}$"
10
+ end
11
+
8
12
  def check_access_by_user file, user, access
9
13
  "sudo -u #{user} -s /bin/test -#{access} #{file}"
10
14
  end
@@ -15,3 +15,6 @@ require 'serverspec/helper/detect_os'
15
15
 
16
16
  # Obsoleted helpers
17
17
  require 'serverspec/helper/obsoleted'
18
+
19
+ # Attributes helper
20
+ require 'serverspec/helper/attributes'
@@ -0,0 +1,14 @@
1
+ require 'serverspec/attributes'
2
+
3
+ module Serverspec
4
+ module Helper
5
+ module Attributes
6
+ def attr
7
+ Serverspec::Attributes.instance.attributes
8
+ end
9
+ def attr_set(attr)
10
+ Serverspec::Attributes.instance.attributes(attr)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.2.28"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -102,6 +102,12 @@ describe 'check_file_contain_within', :os => :darwin do
102
102
  end
103
103
  end
104
104
 
105
+ describe 'check_file_md5checksum', :os => :darwin do
106
+ subject { commands.check_file_md5checksum('/usr/bin/rsync', '03ba2dcdd50ec3a7a45d3900902a83ce') }
107
+ it { should eq "openssl md5 /usr/bin/rsync | cut -d'=' -f2 | cut -c 2- | grep -E ^03ba2dcdd50ec3a7a45d3900902a83ce$" }
108
+ it { should_not eq "openssl md5 /usr/bin/rsync | cut -d'=' -f2 | cut -c 2- | grep -E ^03ba2dcdd50ec3a7a45d3900902a83c" }
109
+ end
110
+
105
111
  describe 'check_mode', :os => :darwin do
106
112
  subject { commands.check_mode('/etc/sudoers', 440) }
107
113
  it { should eq 'stat -c %a /etc/sudoers | grep -- \\^440\\$' }
@@ -22,6 +22,7 @@ describe 'Serverspec matchers of Darwin', :os => :darwin do
22
22
  it_behaves_like 'support contain.from.to matcher', 'Gemfile', 'rspec', /^group :test do/, /^end/
23
23
  it_behaves_like 'support contain.after matcher', 'Gemfile', 'rspec', /^group :test do/
24
24
  it_behaves_like 'support contain.before matcher', 'Gemfile', 'rspec', /^end/
25
+ it_behaves_like 'support match_md5checksum matcher', '/usr/bin/rsync', '03ba2dcdd50ec3a7a45d3900902a83ce'
25
26
  it_behaves_like 'support be_user matcher', 'root'
26
27
  it_behaves_like 'support be_group matcher', 'wheel'
27
28
 
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Attributes
4
+
5
+ describe 'Attributes Helper' do
6
+ before :all do
7
+ attr_set :role => 'proxy'
8
+ end
9
+ subject { attr }
10
+ it { should include :role => 'proxy' }
11
+ end
metadata CHANGED
@@ -1,104 +1,105 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
- version: !ruby/object:Gem::Version
4
- hash: 47
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 2
9
- - 28
10
- version: 0.2.28
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Gosuke Miyashita
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-05-13 00:00:00 +09:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-05-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: net-ssh
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rspec
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
47
38
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: highline
51
39
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: highline
48
+ requirement: !ruby/object:Gem::Requirement
53
49
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
61
54
  type: :runtime
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: bundler
65
55
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
67
57
  none: false
68
- requirements:
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
69
67
  - - ~>
70
- - !ruby/object:Gem::Version
71
- hash: 9
72
- segments:
73
- - 1
74
- - 3
75
- version: "1.3"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
76
70
  type: :development
77
- version_requirements: *id004
78
- - !ruby/object:Gem::Dependency
79
- name: rake
80
71
  prerelease: false
81
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.3'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
82
81
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
90
86
  type: :development
91
- version_requirements: *id005
92
- description: RSpec tests for your servers provisioned by Puppet, Chef or anything else
93
- email:
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: RSpec tests for your servers provisioned by Puppet, Chef or anything
95
+ else
96
+ email:
94
97
  - gosukenator@gmail.com
95
- executables:
98
+ executables:
96
99
  - serverspec-init
97
100
  extensions: []
98
-
99
101
  extra_rdoc_files: []
100
-
101
- files:
102
+ files:
102
103
  - .gitignore
103
104
  - .travis.yml
104
105
  - Gemfile
@@ -107,6 +108,7 @@ files:
107
108
  - Rakefile
108
109
  - bin/serverspec-init
109
110
  - lib/serverspec.rb
111
+ - lib/serverspec/attributes.rb
110
112
  - lib/serverspec/backend.rb
111
113
  - lib/serverspec/backend/exec.rb
112
114
  - lib/serverspec/backend/puppet.rb
@@ -120,6 +122,7 @@ files:
120
122
  - lib/serverspec/commands/solaris.rb
121
123
  - lib/serverspec/filter.rb
122
124
  - lib/serverspec/helper.rb
125
+ - lib/serverspec/helper/attributes.rb
123
126
  - lib/serverspec/helper/darwin.rb
124
127
  - lib/serverspec/helper/debian.rb
125
128
  - lib/serverspec/helper/detect_os.rb
@@ -182,53 +185,46 @@ files:
182
185
  - spec/debian/matchers_spec.rb
183
186
  - spec/gentoo/commands_spec.rb
184
187
  - spec/gentoo/matchers_spec.rb
188
+ - spec/helpers/attributes_spec.rb
185
189
  - spec/redhat/commands_spec.rb
186
190
  - spec/redhat/matchers_spec.rb
187
191
  - spec/solaris/commands_spec.rb
188
192
  - spec/solaris/matchers_spec.rb
189
193
  - spec/spec_helper.rb
190
194
  - spec/support/shared_matcher_examples.rb
191
- has_rdoc: true
192
195
  homepage: http://serverspec.org/
193
- licenses:
196
+ licenses:
194
197
  - MIT
195
198
  post_install_message:
196
199
  rdoc_options: []
197
-
198
- require_paths:
200
+ require_paths:
199
201
  - lib
200
- required_ruby_version: !ruby/object:Gem::Requirement
202
+ required_ruby_version: !ruby/object:Gem::Requirement
201
203
  none: false
202
- requirements:
203
- - - ">="
204
- - !ruby/object:Gem::Version
205
- hash: 3
206
- segments:
207
- - 0
208
- version: "0"
209
- required_rubygems_version: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ! '>='
206
+ - !ruby/object:Gem::Version
207
+ version: '0'
208
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
209
  none: false
211
- requirements:
212
- - - ">="
213
- - !ruby/object:Gem::Version
214
- hash: 3
215
- segments:
216
- - 0
217
- version: "0"
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
218
214
  requirements: []
219
-
220
215
  rubyforge_project:
221
- rubygems_version: 1.3.7
216
+ rubygems_version: 1.8.25
222
217
  signing_key:
223
218
  specification_version: 3
224
219
  summary: RSpec tests for your servers provisioned by Puppet, Chef or anything else
225
- test_files:
220
+ test_files:
226
221
  - spec/darwin/commands_spec.rb
227
222
  - spec/darwin/matchers_spec.rb
228
223
  - spec/debian/commands_spec.rb
229
224
  - spec/debian/matchers_spec.rb
230
225
  - spec/gentoo/commands_spec.rb
231
226
  - spec/gentoo/matchers_spec.rb
227
+ - spec/helpers/attributes_spec.rb
232
228
  - spec/redhat/commands_spec.rb
233
229
  - spec/redhat/matchers_spec.rb
234
230
  - spec/solaris/commands_spec.rb