Class: IISConfig::Application

Inherits:
IISObject show all
Defined in:
lib/iisconfig/application.rb

Instance Method Summary collapse

Methods inherited from IISObject

#exist?, #start_provider_exist?

Instance Method Details

#app_pool(name) ⇒ Object



27
28
29
# File 'lib/iisconfig/application.rb', line 27

def app_pool(name)
  @app_pool = name
end

#auto_start_provider(name, type) ⇒ Object



18
19
20
21
# File 'lib/iisconfig/application.rb', line 18

def auto_start_provider(name, type)
  @start_provider_name = name
  @start_provider_type = type
end

#build_commands(site, app_pool) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/iisconfig/application.rb', line 35

def build_commands(site, app_pool)
  commands = []

  commands << %W{ADD APP /site.name:#{site} /path:#{@path} /physicalPath:#{@physical_path.gsub(/\//, '\\')}}

  app_pool = @app_pool unless @app_pool.nil?
  commands << %W{SET SITE /site.name:#{site}/#{@name} /[path='#{@path}'].applicationPool:#{app_pool}}

  if @start_provider_name
    commands << %W{set config -section:system.applicationHost/serviceAutoStartProviders /-"[name='#{@start_provider_name}']" /commit:apphost} if start_provider_exist? @start_provider_name
    commands << %W{set config -section:system.applicationHost/serviceAutoStartProviders /+"[name='#{@start_provider_name}',type='#{@start_provider_type}']" /commit:apphost}
    commands << %W{set app #{site}/#{@name} /serviceAutoStartEnabled:True /serviceAutoStartProvider:#{@start_provider_name}}
  end

  @virtual_directories.each do |s|
    commands += s.build_commands "#{site}/#{@name}"
  end

  commands
end

#name(name) ⇒ Object



8
9
10
11
12
# File 'lib/iisconfig/application.rb', line 8

def name(name)
  @name = name
  @virtual_directories = []
  @app_pool = nil
end

#path(path) ⇒ Object



14
15
16
# File 'lib/iisconfig/application.rb', line 14

def path(path)
  @path = path
end

#physical_path(path) ⇒ Object



23
24
25
# File 'lib/iisconfig/application.rb', line 23

def physical_path(path)
  @physical_path = path
end

#virtual_directory(&block) ⇒ Object



31
32
33
# File 'lib/iisconfig/application.rb', line 31

def virtual_directory(&block)
  add_instance(@virtual_directories, IISConfig::VirtualDirectory, block)
end