Sha256: ede938b8a9aa4f76c208fb6c866207ee422613da88a98371b223602bd3eaeda0
Contents?: true
Size: 824 Bytes
Versions: 8
Compression:
Stored size: 824 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}")).stdout end def file_exist?(path) result = exec(Beaker::Command.new("if exist #{path} echo true"), accept_all_exit_codes: true) result.stdout.strip == 'true' end end
Version data entries
8 entries across 8 versions & 1 rubygems