Class: IISConfig::IISConfiguration

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

Constant Summary collapse

@@dry_run =
false

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ IISConfiguration

Returns a new instance of IISConfiguration.



13
14
15
16
17
18
19
20
# File 'lib/iisconfig/configuration.rb', line 13

def initialize(options = {})
  @options = {recycle_apppools: false}.merge(options)
  @app_pools = []
  @sites = []
  @ftp_sites = []
  @before = []
  @after = []
end

Class Method Details

.dry_run=(dry_run) ⇒ Object



22
23
24
# File 'lib/iisconfig/configuration.rb', line 22

def self.dry_run=dry_run
  @@dry_run = dry_run
end

.dry_run?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/iisconfig/configuration.rb', line 26

def self.dry_run?
  @@dry_run
end

Instance Method Details

#after(&block) ⇒ Object



46
47
48
# File 'lib/iisconfig/configuration.rb', line 46

def after(&block)
  @after << block
end

#app_pool(&block) ⇒ Object



30
31
32
# File 'lib/iisconfig/configuration.rb', line 30

def app_pool(&block)
  add_instance @app_pools, IISConfig::AppPool, block
end

#before(&block) ⇒ Object



42
43
44
# File 'lib/iisconfig/configuration.rb', line 42

def before(&block)
  @before << block
end

#ftp_site(&block) ⇒ Object



38
39
40
# File 'lib/iisconfig/configuration.rb', line 38

def ftp_site(&block)
  add_instance @ftp_sites, IISConfig::FtpSite, block
end

#load(path) ⇒ Object



50
51
52
# File 'lib/iisconfig/configuration.rb', line 50

def load(path)
  instance_eval IO.read(path), path
end

#runObject



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/iisconfig/configuration.rb', line 54

def run
  @before.each { |a| a.call }

  if @options[:recycle_apppools]
    recycle_application_pools
  else
    rebuild_all
  end

  @after.each { |a| a.call }
end

#site(&block) ⇒ Object



34
35
36
# File 'lib/iisconfig/configuration.rb', line 34

def site(&block)
  add_instance @sites, IISConfig::Site, block
end