Method: Specinfra::Backend::PowerShell::ScriptHelper#add_pre_command

Defined in:
lib/specinfra/backend/powershell/script_helper.rb

#add_pre_command(cmd) ⇒ Object


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/specinfra/backend/powershell/script_helper.rb', line 20

def add_pre_command(cmd)
  path = get_config(:path)
  if get_config(:pre_command)
    cmd.strip!
    cmd = 
<<-EOF
if (#{get_config(:pre_command)})
{
#{cmd}
}
EOF
    cmd = "$env:path = \"#{path};$env:path\"\n#{cmd}" if path
  end
  cmd
end