Class: IISSiteBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(siteName, sitePath, webSiteIdentifier = WebSiteIdentifier.new, iisAppCmd = IISAppCmd.new) ⇒ IISSiteBuilder



8
9
10
11
12
13
# File 'lib/IIS_site_builder.rb', line 8

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

Instance Attribute Details

#webSiteIdentifierObject

Returns the value of attribute webSiteIdentifier.



6
7
8
# File 'lib/IIS_site_builder.rb', line 6

def webSiteIdentifier
  @webSiteIdentifier
end

Instance Method Details

#createObject



24
25
26
27
28
# File 'lib/IIS_site_builder.rb', line 24

def create
  puts "creating site #{@siteName}"
  @iisAppCmd.execute("ADD SITE /name:#{@siteName} /bindings:http://#{@siteName}:80 /physicalPath:#{@sitePath}")
  self
end

#deleteObject



15
16
17
18
19
20
21
22
# File 'lib/IIS_site_builder.rb', line 15

def delete
  puts "attempting delete of #{@siteName}"
  if @webSiteIdentifier.exists(@siteName)
    @iisAppCmd.execute("DELETE SITE #{@siteName}")
    puts "deleted site #{@siteName}"
  end
  self
end