specinfra 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/specinfra/backend/cmd.rb +27 -1
- data/lib/specinfra/command/windows.rb +46 -42
- data/lib/specinfra/version.rb +1 -1
- data/lib/specinfra.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b4eed13de93f62f2bbb57ce355ea22684606c06
|
4
|
+
data.tar.gz: 14c461c8b5fc9c94761dede212cd8f67d69a60b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1310556dbf0eac4ea57809c3e8a9c19c8f3b6edd4d735333e6b7d63cc2f89839c359ebc49542b2bbf995dd4b3cc1137819175f29bfa23a1a7cc5f8e2d664563a
|
7
|
+
data.tar.gz: 5efff319c39a3328d342b49936c45e8b6079208e715ae279e2b3dda7ca047fa126df39c5e7abd8d702b96f1a159ed4a1a587b6a733a94c16b0bf1eeba8c82e79
|
@@ -7,7 +7,7 @@ module SpecInfra
|
|
7
7
|
|
8
8
|
def run_command(cmd, opts={})
|
9
9
|
script = create_script(cmd)
|
10
|
-
result = execute_script %Q{powershell -encodedCommand #{encode_script(script)}}
|
10
|
+
result = execute_script %Q{#{powershell} -encodedCommand #{encode_script(script)}}
|
11
11
|
|
12
12
|
if @example
|
13
13
|
@example.metadata[:command] = script
|
@@ -34,6 +34,32 @@ module SpecInfra
|
|
34
34
|
# Dirty hack for specs
|
35
35
|
'Windows'
|
36
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def powershell
|
41
|
+
architecture = @example.metadata[:architecture] || SpecInfra.configuration.architecture
|
42
|
+
|
43
|
+
case architecture
|
44
|
+
when :i386 then x86_powershell
|
45
|
+
when :x86_64 then x64_powershell
|
46
|
+
else raise ArgumentError, "invalid architecture [#{architecture}]"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def x64_powershell
|
51
|
+
find_powershell(%w(sysnative system32))
|
52
|
+
end
|
53
|
+
|
54
|
+
def x86_powershell
|
55
|
+
find_powershell(%w(syswow64 system32))
|
56
|
+
end
|
57
|
+
|
58
|
+
def find_powershell(dirs)
|
59
|
+
dirs.map { |dir| "#{ENV['WINDIR']}\\#{dir}\\WindowsPowerShell\\v1.0\\powershell.exe" }
|
60
|
+
.find { |exe| File.exists?(exe) } || 'powershell'
|
61
|
+
end
|
62
|
+
|
37
63
|
end
|
38
64
|
end
|
39
65
|
end
|
@@ -66,6 +66,10 @@ module SpecInfra
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def get_file_content(file)
|
70
|
+
"[Io.File]::ReadAllText('#{file}')"
|
71
|
+
end
|
72
|
+
|
69
73
|
def check_access_by_user(file, user, access)
|
70
74
|
case access
|
71
75
|
when 'r'
|
@@ -229,61 +233,61 @@ module SpecInfra
|
|
229
233
|
using 'list_windows_features.ps1'
|
230
234
|
exec cmd
|
231
235
|
end
|
232
|
-
|
236
|
+
end
|
233
237
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
+
def check_file_version(name,version)
|
239
|
+
cmd = "((Get-Command '#{name}').FileVersionInfo.ProductVersion -eq '#{version}') -or ((Get-Command '#{name}').FileVersionInfo.FileVersion -eq '#{version}')"
|
240
|
+
Backend::PowerShell::Command.new { exec cmd }
|
241
|
+
end
|
238
242
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
243
|
+
def check_iis_website_enabled(name)
|
244
|
+
Backend::PowerShell::Command.new do
|
245
|
+
using 'find_iis_component.ps1'
|
246
|
+
exec "(FindIISWebsite -name '#{name}').serverAutoStart -eq $true"
|
247
|
+
end
|
248
|
+
end
|
245
249
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
250
|
+
def check_iis_website_installed(name)
|
251
|
+
Backend::PowerShell::Command.new do
|
252
|
+
using 'find_iis_component.ps1'
|
253
|
+
exec "@(FindIISWebsite -name '#{name}').count -gt 0"
|
254
|
+
end
|
255
|
+
end
|
252
256
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
257
|
+
def check_iis_website_running(name)
|
258
|
+
Backend::PowerShell::Command.new do
|
259
|
+
using 'find_iis_component.ps1'
|
260
|
+
exec "(FindIISWebsite -name '#{name}').state -eq 'Started'"
|
261
|
+
end
|
262
|
+
end
|
259
263
|
|
260
|
-
|
264
|
+
def check_iis_website_app_pool(name, app_pool)
|
261
265
|
Backend::PowerShell::Command.new do
|
262
|
-
|
263
|
-
|
264
|
-
end
|
266
|
+
using 'find_iis_component.ps1'
|
267
|
+
exec "(FindIISWebsite -name '#{name}').applicationPool -match '#{app_pool}'"
|
265
268
|
end
|
269
|
+
end
|
266
270
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
end
|
271
|
+
def check_iis_website_path(name, path)
|
272
|
+
Backend::PowerShell::Command.new do
|
273
|
+
using 'find_iis_component.ps1'
|
274
|
+
exec "[System.Environment]::ExpandEnvironmentVariables( ( FindIISWebsite -name '#{name}' ).physicalPath ).replace('\\', '/' ) -eq ('#{path}'.trimEnd('/').replace('\\', '/'))"
|
272
275
|
end
|
276
|
+
end
|
273
277
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
end
|
278
|
+
def check_iis_app_pool(name)
|
279
|
+
Backend::PowerShell::Command.new do
|
280
|
+
using 'find_iis_component.ps1'
|
281
|
+
exec "@(FindIISAppPool -name '#{name}').count -gt 0"
|
279
282
|
end
|
283
|
+
end
|
280
284
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
end
|
285
|
+
def check_iis_app_pool_dotnet(name, dotnet)
|
286
|
+
Backend::PowerShell::Command.new do
|
287
|
+
using 'find_iis_component.ps1'
|
288
|
+
exec "(FindIISAppPool -name '#{name}').managedRuntimeVersion -match 'v#{dotnet}'"
|
286
289
|
end
|
290
|
+
end
|
287
291
|
|
288
292
|
private
|
289
293
|
|
data/lib/specinfra/version.rb
CHANGED
data/lib/specinfra.rb
CHANGED
@@ -24,6 +24,7 @@ if defined?(RSpec)
|
|
24
24
|
c.add_setting :scp, :default => nil
|
25
25
|
c.add_setting :sudo_password, :default => nil
|
26
26
|
c.add_setting :winrm, :default => nil
|
27
|
+
c.add_setting :architecture, :default => :x86_64
|
27
28
|
SpecInfra.configuration.defaults.each { |k, v| c.add_setting k, :default => v }
|
28
29
|
c.before :each do
|
29
30
|
if respond_to?(:backend) && backend.respond_to?(:set_example)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|