Module: PSWindows::File

Includes:
Beaker::CommandFactory
Included in:
Host
Defined in:
lib/beaker/host/pswindows/file.rb

Instance Attribute Summary

Attributes included from Beaker::CommandFactory

#assertions

Instance Method Summary collapse

Methods included from Beaker::CommandFactory

#execute, #fail_test

Instance Method Details

#file_exist?(path) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/beaker/host/pswindows/file.rb', line 18

def file_exist?(path)
  result = exec(Beaker::Command.new("if exist #{path} echo true"), :acceptable_exit_codes => [0, 1])
  result.stdout =~ /true/
end

#path_split(paths) ⇒ Object



14
15
16
# File 'lib/beaker/host/pswindows/file.rb', line 14

def path_split(paths)
  paths.split(';')
end

#tmpdir(name) ⇒ Object



9
10
11
12
# File 'lib/beaker/host/pswindows/file.rb', line 9

def tmpdir(name)
  result = exec(powershell('[System.IO.Path]::GetTempPath()'))
  result.stdout.chomp()
end

#tmpfile(name) ⇒ Object



4
5
6
7
# File 'lib/beaker/host/pswindows/file.rb', line 4

def tmpfile(name)
  result = exec(powershell('[System.IO.Path]::GetTempFileName()'))
  result.stdout.chomp()
end