serverspec 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,25 @@ module Serverspec
9
9
  "openssl md5 #{escape(file)} | cut -d'=' -f2 | cut -c 2- | grep -E ^#{escape(expected)}$"
10
10
  end
11
11
 
12
+ def check_mode file, mode
13
+ regexp = "^#{mode}$"
14
+ "stat -f %A #{escape(file)} | grep -- #{escape(regexp)}"
15
+ end
16
+
17
+ def check_owner file, owner
18
+ regexp = "^#{owner}$"
19
+ "stat -f %Su #{escape(file)} | grep -- #{escape(regexp)}"
20
+ end
21
+
22
+ def check_grouped file, group
23
+ regexp = "^#{group}$"
24
+ "stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}"
25
+ end
26
+
27
+ def get_mode(file)
28
+ "stat -f %A #{escape(file)}"
29
+ end
30
+
12
31
  def check_access_by_user file, user, access
13
32
  "sudo -u #{user} -s /bin/test -#{access} #{file}"
14
33
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -110,22 +110,21 @@ end
110
110
  describe 'check_file_md5checksum', :os => :darwin do
111
111
  subject { commands.check_file_md5checksum('/usr/bin/rsync', '03ba2dcdd50ec3a7a45d3900902a83ce') }
112
112
  it { should eq "openssl md5 /usr/bin/rsync | cut -d'=' -f2 | cut -c 2- | grep -E ^03ba2dcdd50ec3a7a45d3900902a83ce$" }
113
- it { should_not eq "openssl md5 /usr/bin/rsync | cut -d'=' -f2 | cut -c 2- | grep -E ^03ba2dcdd50ec3a7a45d3900902a83c" }
114
113
  end
115
114
 
116
115
  describe 'check_mode', :os => :darwin do
117
116
  subject { commands.check_mode('/etc/sudoers', 440) }
118
- it { should eq 'stat -c %a /etc/sudoers | grep -- \\^440\\$' }
117
+ it { should eq 'stat -f %A /etc/sudoers | grep -- \\^440\\$' }
119
118
  end
120
119
 
121
120
  describe 'check_owner', :os => :darwin do
122
121
  subject { commands.check_owner('/etc/passwd', 'root') }
123
- it { should eq 'stat -c %U /etc/passwd | grep -- \\^root\\$' }
122
+ it { should eq 'stat -f %Su /etc/passwd | grep -- \\^root\\$' }
124
123
  end
125
124
 
126
125
  describe 'check_grouped', :os => :darwin do
127
126
  subject { commands.check_grouped('/etc/passwd', 'wheel') }
128
- it { should eq 'stat -c %G /etc/passwd | grep -- \\^wheel\\$' }
127
+ it { should eq 'stat -f %Sg /etc/passwd | grep -- \\^wheel\\$' }
129
128
  end
130
129
 
131
130
  describe 'check_cron_entry', :os => :darwin do
@@ -188,7 +187,7 @@ end
188
187
 
189
188
  describe 'get_mode', :os => :darwin do
190
189
  subject { commands.get_mode('/dev') }
191
- it { should eq 'stat -c %a /dev' }
190
+ it { should eq 'stat -f %A /dev' }
192
191
  end
193
192
 
194
193
  describe 'check_access_by_user', :os => :darwin do
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: 17
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
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-14 00:00:00 +09:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-05-14 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
@@ -193,41 +194,32 @@ files:
193
194
  - spec/solaris/matchers_spec.rb
194
195
  - spec/spec_helper.rb
195
196
  - spec/support/shared_matcher_examples.rb
196
- has_rdoc: true
197
197
  homepage: http://serverspec.org/
198
- licenses:
198
+ licenses:
199
199
  - MIT
200
200
  post_install_message:
201
201
  rdoc_options: []
202
-
203
- require_paths:
202
+ require_paths:
204
203
  - lib
205
- required_ruby_version: !ruby/object:Gem::Requirement
204
+ required_ruby_version: !ruby/object:Gem::Requirement
206
205
  none: false
207
- requirements:
208
- - - ">="
209
- - !ruby/object:Gem::Version
210
- hash: 3
211
- segments:
212
- - 0
213
- version: "0"
214
- required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ! '>='
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
211
  none: false
216
- requirements:
217
- - - ">="
218
- - !ruby/object:Gem::Version
219
- hash: 3
220
- segments:
221
- - 0
222
- version: "0"
212
+ requirements:
213
+ - - ! '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
223
216
  requirements: []
224
-
225
217
  rubyforge_project:
226
- rubygems_version: 1.3.7
218
+ rubygems_version: 1.8.25
227
219
  signing_key:
228
220
  specification_version: 3
229
221
  summary: RSpec tests for your servers provisioned by Puppet, Chef or anything else
230
- test_files:
222
+ test_files:
231
223
  - spec/darwin/commands_spec.rb
232
224
  - spec/darwin/matchers_spec.rb
233
225
  - spec/debian/commands_spec.rb