Module: Windows::File
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
- #file_exist?(path) ⇒ Boolean
- #path_split(paths) ⇒ Object
-
#scp_path(path) ⇒ String
Updates a file path for use with SCP, depending on the SSH Server.
- #system_temp_path ⇒ Object
- #tmpdir(name) ⇒ Object
- #tmpfile(name) ⇒ Object
Methods included from Beaker::CommandFactory
Instance Method Details
#file_exist?(path) ⇒ Boolean
41 42 43 44 |
# File 'lib/beaker/host/windows/file.rb', line 41 def file_exist?(path) result = exec(Beaker::Command.new("test -e '#{path}'"), :acceptable_exit_codes => [0, 1]) result.exit_code == 0 end |
#path_split(paths) ⇒ Object
37 38 39 |
# File 'lib/beaker/host/windows/file.rb', line 37 def path_split(paths) paths.split(';') end |
#scp_path(path) ⇒ String
Note:
This will fail with an SSH server that is not OpenSSL or BitVise.
Updates a file path for use with SCP, depending on the SSH Server
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/beaker/host/windows/file.rb', line 25 def scp_path(path) case determine_ssh_server when :bitvise # swap out separators network_path = path.gsub('\\', scp_separator) when :openssh path else raise ArgumentError("windows/file.rb:scp_path: ssh server not recognized: '#{determine_ssh_server}'") end end |
#system_temp_path ⇒ Object
12 13 14 15 16 |
# File 'lib/beaker/host/windows/file.rb', line 12 def system_temp_path # under CYGWIN %TEMP% may not be set tmp_path = execute('ECHO %SYSTEMROOT%', :cmdexe => true) tmp_path.gsub(/\n/, '') + '\\TEMP' end |
#tmpdir(name) ⇒ Object
8 9 10 |
# File 'lib/beaker/host/windows/file.rb', line 8 def tmpdir(name) execute("cygpath -m $(mktemp -td #{name}.XXXXXX)") end |
#tmpfile(name) ⇒ Object
4 5 6 |
# File 'lib/beaker/host/windows/file.rb', line 4 def tmpfile(name) execute("cygpath -m $(mktemp -t #{name}.XXXXXX)") end |