Class: IISConfig::Runner

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

Class Method Summary collapse

Class Method Details

.execute_command(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/iisconfig/runner.rb', line 5

def self.execute_command(args)
  args = [args].flatten
  tool = :appcmd

  safe_command = args.map { |v| v.is_a?(IISConfig::Command) ? v.safe_command : v }
  command = args.map { |v| v.is_a?(IISConfig::Command) ? v.command : v }

  puts  "  #{tool.to_s} #{safe_command.join(' ')}"

  unless IISConfiguration.dry_run?
    result = `c:/windows/system32/inetsrv/appcmd #{command.join(' ')}"`
    puts result if IISConfiguration.verbose?
    raise Exception.new($?.exitstatus) unless $?.success?
    result
  end
end

.run_commands(commands) ⇒ Object



22
23
24
25
26
# File 'lib/iisconfig/runner.rb', line 22

def self.run_commands(commands)
  commands.each do |c|
    Runner.execute_command c
  end
end