Module: Windows::File
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
- #chgrp(group, path, recursive = false) ⇒ Object
-
#chmod(mod, path, recursive = false) ⇒ Object
Not needed on windows.
- #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 = '', extension = nil) ⇒ 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 |
#chmod(mod, path, recursive = false) ⇒ Object
Not needed on windows
39 |
# File 'lib/beaker/host/windows/file.rb', line 39 def chmod(mod, path, recursive = false); 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
76 77 78 79 |
# File 'lib/beaker/host/windows/file.rb', line 76 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.
46 47 48 49 |
# File 'lib/beaker/host/windows/file.rb', line 46 def ls_ld(path) cygpath = execute("cygpath -u #{path}") super(cygpath) end |
#path_split(paths) ⇒ Object
72 73 74 |
# File 'lib/beaker/host/windows/file.rb', line 72 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
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/beaker/host/windows/file.rb', line 58 def scp_path(path) case determine_ssh_server when :bitvise # swap out separators path.gsub('\\', scp_separator) when :openssh path when :win32_openssh path.tr('\\', '/') 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.delete("\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 = '', extension = nil) ⇒ Object
4 5 6 |
# File 'lib/beaker/host/windows/file.rb', line 4 def tmpfile(name = '', extension = nil) execute("cygpath -m $(mktemp -t #{name}.XXXXXX#{extension})") end |