class IISHostAdder

Public Class Methods

new(siteName, iisAppCmd = IISAppCmd.new) click to toggle source
# File lib/IIS_host_adder.rb, line 4
def initialize(siteName, iisAppCmd = IISAppCmd.new)
        @siteName = siteName
        @iisAppCmd = iisAppCmd
end

Public Instance Methods

addMultiple(hosts, protocol = "http") click to toggle source
# File lib/IIS_host_adder.rb, line 14
def addMultiple(hosts, protocol = "http")
        puts "adding multiple sites for site #{@siteName}"
        hosts.each {|host| addSingle(host) }
end
addSingle(host, protocol = "http") click to toggle source
# File lib/IIS_host_adder.rb, line 9
def addSingle(host, protocol = "http")
        #puts "adding host #{host} to site #{@siteName}"
        @iisAppCmd.execute("SET CONFIG -section:system.applicationHost/sites /+\"[name='#{@siteName}'].bindings.[protocol='#{protocol}',bindingInformation='*:#{host}']\" /commit:apphost")
end