class WebSiteIdentifier

Public Class Methods

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

Public Instance Methods

exists(siteName) click to toggle source
# File lib/web_site_identifier.rb, line 10
def exists(siteName)
        siteInfo = @iisAppCmd.execute("LIST SITE")
        siteExits = siteInfo.include?(siteName)
        puts "checking if site #{siteName} exists : #{siteExits}"
        siteExits
end
getId(siteName) click to toggle source
# File lib/web_site_identifier.rb, line 17
def getId(siteName)
        siteInfo = @iisAppCmd.execute("LIST SITE /site.name:#{siteName}")
        parseId(siteInfo)
end

Private Instance Methods

parseId(siteInfo) click to toggle source
# File lib/web_site_identifier.rb, line 23
def parseId(siteInfo)
        match = /id:(\d+),/.match(siteInfo)
        match[1].to_s
end