Class: IISHostAdder

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

Instance Method Summary collapse

Constructor Details

#initialize(siteName, iisAppCmd = IISAppCmd.new) ⇒ IISHostAdder

Returns a new instance of IISHostAdder.



4
5
6
7
# File 'lib/IIS_host_adder.rb', line 4

def initialize(siteName, iisAppCmd = IISAppCmd.new)
	@siteName = siteName
	@iisAppCmd = iisAppCmd
end

Instance Method Details

#addMultiple(hosts, protocol = "http") ⇒ Object



14
15
16
17
# 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") ⇒ Object



9
10
11
12
# 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