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)


20
21
22
23
# File 'lib/beaker/host/pswindows/file.rb', line 20

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



16
17
18
# File 'lib/beaker/host/pswindows/file.rb', line 16

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

#tmpdir(name) ⇒ Object



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

def tmpdir(name)
  # generate name
  tmpdirname = execute("echo C:\\Windows\\Temp\\#{name}.%RANDOM%")
  # created named dir
  execute("md #{tmpdirname}")
  tmpdirname
end

#tmpfile(name) ⇒ Object



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

def tmpfile(name)
  execute("echo C:\\Windows\\Temp\\#{name}.%RANDOM%")
end