Module: Windows::File
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
- #chgrp(group, path, recursive = false) ⇒ Object
- #chown(user, path, recursive = false) ⇒ Object
- #file_exist?(path) ⇒ Boolean
- #ls_ld(path) ⇒ Object
- #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
#chgrp(group, path, recursive = false) ⇒ Object
Cygwin’s ‘chgrp` implementation does not support windows-, DOS-, or mixed-style paths, only UNIX/POSIX-style. This method simply wraps the normal Host#chgrp call with a call to cygpath to sanitize input.
33 34 35 36 |
# File 'lib/beaker/host/windows/file.rb', line 33 def chgrp(group, path, recursive=false) cygpath = execute("cygpath -u #{path}") super(group, cygpath, recursive) end |
#chown(user, path, recursive = false) ⇒ Object
Cygwin’s ‘chown` implementation does not support windows-, DOS-, or mixed-style paths, only UNIX/POSIX-style. This method simply wraps the normal Host#chown call with a call to cygpath to sanitize input.
23 24 25 26 |
# File 'lib/beaker/host/windows/file.rb', line 23 def chown(user, path, recursive=false) cygpath = execute("cygpath -u #{path}") super(user, cygpath, recursive) end |
#file_exist?(path) ⇒ Boolean
71 72 73 74 |
# File 'lib/beaker/host/windows/file.rb', line 71 def file_exist?(path) result = exec(Beaker::Command.new("test -e '#{path}'"), :acceptable_exit_codes => [0, 1]) result.exit_code == 0 end |
#ls_ld(path) ⇒ Object
Cygwin’s ‘ls_ld` implementation does not support windows-, DOS-, or mixed-style paths, only UNIX/POSIX-style. This method simply wraps the normal Host#ls_ld call with a call to cygpath to sanitize input.
43 44 45 46 |
# File 'lib/beaker/host/windows/file.rb', line 43 def ls_ld(path) cygpath = execute("cygpath -u #{path}") super(cygpath) end |
#path_split(paths) ⇒ Object
67 68 69 |
# File 'lib/beaker/host/windows/file.rb', line 67 def path_split(paths) paths.split(';') end |
#scp_path(path) ⇒ String
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
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/beaker/host/windows/file.rb', line 55 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 |