Sha256: 7b7c8fa667d84e1b8d1fc920d55f3b55069a941874c0c00acf67ed5e97d394ca
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 KB
Contents
module Machinery::ScopeFileAccessFlat def retrieve_files_from_system(system, paths) system.retrieve_files(paths, scope_file_store.path) end def write_file(system_file, target) raise Machinery::Errors::FileUtilsError, "Not a file" unless system_file.file? target_path = File.join(target, system_file.name) FileUtils.mkdir_p(File.dirname(target_path)) FileUtils.cp(file_path(system_file), target_path) end def file_path(system_file) raise Machinery::Errors::FileUtilsError, "Not a file" unless system_file.file? File.join(scope_file_store.path, system_file.name) end def file_content(system_file) unless extracted raise Machinery::Errors::FileUtilsError, "The requested file '#{system_file.name}' is" \ " not available because files for scope '#{scope_name}' were not extracted." end File.read(file_path(system_file)) end def binary?(system_file) path = system_file.scope.file_path(system_file) return false if File.zero?(path) Machinery.content_is_binary?(File.read(path, 4096)) end def has_file?(name) return true if any? { |file| file.name == name } end end
Version data entries
6 entries across 6 versions & 1 rubygems