Sha256: 0a060e96d63b1ff5263a4185b4f368ff16f5a4661215f2353f9e77461b9d410f
Contents?: true
Size: 815 Bytes
Versions: 3
Compression:
Stored size: 815 Bytes
Contents
module PSWindows::File include Beaker::CommandFactory def tmpfile(name = '') result = exec(powershell('[System.IO.Path]::GetTempFileName()')) result.stdout.chomp() end def tmpdir(name = '') tmp_path = exec(powershell('[System.IO.Path]::GetTempPath()')).stdout.chomp() if name == '' name = exec(powershell('[System.IO.Path]::GetRandomFileName()')).stdout.chomp() end exec(powershell("New-Item -Path '#{tmp_path}' -Force -Name '#{name}' -ItemType 'directory'")) File.join(tmp_path, name) end def path_split(paths) paths.split(';') end def cat(path) exec(powershell("type #{path}")) end def file_exist?(path) result = exec(Beaker::Command.new("if exist #{path} echo true"), :acceptable_exit_codes => [0, 1]) result.stdout =~ /true/ end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
beaker-4.23.2 | lib/beaker/host/pswindows/file.rb |
beaker-4.23.1 | lib/beaker/host/pswindows/file.rb |
beaker-4.23.0 | lib/beaker/host/pswindows/file.rb |