Sha256: fbd6c9a7466df3996e7ae3fee907a68d489b5bfcdbf9c068ccbd052e95ac17b4
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
Contents
module 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" if !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" if !system_file.file? File.join(scope_file_store.path, system_file.name) end def file_content(system_file) if !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 files.any? { |file| file.name == name } end end
Version data entries
5 entries across 5 versions & 1 rubygems