Module: PSWindows::File
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
- #file_exist?(path) ⇒ Boolean
- #path_split(paths) ⇒ Object
- #tmpdir(name) ⇒ Object
- #tmpfile(name) ⇒ Object
Methods included from Beaker::CommandFactory
Instance Method Details
#file_exist?(path) ⇒ 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 |