File: iis_website.rb

package info (click to toggle)
ruby-specinfra 2.94.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,464 kB
  • sloc: ruby: 10,562; makefile: 4
file content (59 lines) | stat: -rw-r--r-- 2,136 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class Specinfra::Command::Windows::Base::IisWebsite < Specinfra::Command::Windows::Base
  class << self
    def check_is_enabled(name)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "(FindIISWebsite -name '#{name}').serverAutoStart -eq $true"
      end
    end

    def check_is_installed(name)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "@(FindIISWebsite -name '#{name}').count -gt 0"
      end
    end

    def check_is_running(name)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "(FindIISWebsite -name '#{name}').state -eq 'Started'"
      end
    end

    def check_is_in_app_pool(name, app_pool)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "(FindIISWebsite -name '#{name}').applicationPool -match '#{app_pool}'"
      end
    end

    def check_has_physical_path(name, path)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "[System.Environment]::ExpandEnvironmentVariables( ( FindIISWebsite -name '#{name}' ).physicalPath ).replace('\\', '/' ) -eq ('#{path}'.trimEnd('/').replace('\\', '/'))"
      end
    end

    def check_has_site_bindings(name, port, protocol, ipaddress, host_header)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "(FindSiteBindings -name '#{name}' -protocol '#{protocol}' -hostHeader '#{host_header}' -port #{port} -ipAddress '#{ipaddress}').count -gt 0"
      end
    end

    def check_has_virtual_dir(name, vdir, path)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "(FindSiteVirtualDir -name '#{name}' -vdir '#{vdir}' -path '#{path}') -eq $true"
      end
    end

    def check_has_site_application(name, app, pool, physical_path)
      Backend::PowerShell::Command.new do
        using 'find_iis_component.ps1'
        exec "(FindSiteApplication -name '#{name}' -app '#{app}' -pool '#{pool}' -physicalPath '#{physical_path}') -eq $true"
      end
    end
  end
end