Module: Windows::Exec

Includes:
Beaker::CommandFactory
Included in:
Host
Defined in:
lib/beaker/host/windows/exec.rb

Constant Summary collapse

ABS_CMD =
'c:\\\\windows\\\\system32\\\\cmd.exe'
CMD =
'cmd.exe'

Instance Attribute Summary

Attributes included from Beaker::CommandFactory

#assertions

Instance Method Summary collapse

Methods included from Beaker::CommandFactory

#execute, #fail_test

Instance Method Details

#echo(msg, abs = true) ⇒ Object



7
8
9
# File 'lib/beaker/host/windows/exec.rb', line 7

def echo(msg, abs=true)
  (abs ? ABS_CMD : CMD) + " /c echo #{msg}"
end

#get_ipObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/beaker/host/windows/exec.rb', line 19

def get_ip
  ip = execute("ipconfig | grep -i 'IP Address' | cut -d: -f2 | head -1").strip
  if ip == ''
    ip = execute("ipconfig | grep -i 'IPv4 Address' | cut -d: -f2 | head -1").strip
  end
  if ip == ''
    ip = execute("ipconfig | grep -i 'IPv6 Address' | cut -d: -f2 | head -1").strip
  end
  ip
end

#pathObject



15
16
17
# File 'lib/beaker/host/windows/exec.rb', line 15

def path
  'c:/windows/system32;c:/windows'
end

#touch(file, abs = true) ⇒ Object



11
12
13
# File 'lib/beaker/host/windows/exec.rb', line 11

def touch(file, abs=true)
  (abs ? ABS_CMD : CMD) + " /c echo. 2> #{file}"
end