Class: IISConfig::IISObject

Inherits:
Object
  • Object
show all
Defined in:
lib/iisconfig/iis_object.rb

Direct Known Subclasses

AppPool, Application, FtpSite, Site, VirtualDirectory

Instance Method Summary collapse

Instance Method Details

#exist?(type, name) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/iisconfig/iis_object.rb', line 7

def exist?(type, name)
  args = []
  args << 'LIST'
  args << type.to_s.upcase
  args << '/xml'
  result = Runner.execute_command args

  exists = false
  doc = REXML::Document.new(result)

  doc.elements.each("appcmd/#{type.to_s.upcase}[@#{type.to_s.upcase}.NAME='#{name}']") do
    exists = true
    break
  end

  exists
end