class ZKSync::Archive
Attributes
file_index[R]
fs_base_path[R]
keystore[R]
root[R]
Public Class Methods
new(passphrase, fs_base_path, root)
click to toggle source
# File lib/zksync/archive.rb, line 22 def initialize(passphrase, fs_base_path, root) @root = root @fs_base_path = fs_base_path @keystore = KeyStore.new(Key.new(passphrase, type: :passphrase)) @file_index = CryptoFileIndex.new("@@index", self) end
Public Instance Methods
add(fs_paths)
click to toggle source
add fs-paths to the archive. returns array of paths that were not added successfully. archive paths are stored relative to basepath
# File lib/zksync/archive.rb, line 31 def add(fs_paths) [*fs_paths] .map { |fs_path| File.expand_path(fs_path) } .reject { |fs_path| add_file(fs_path) } end
add_file(fs_path)
click to toggle source
# File lib/zksync/archive.rb, line 60 def add_file(fs_path) archive_path = Pathname.new(fs_path).relative_path_from(Pathname.new(fs_base_path)).to_s @file_index.add(archive_path, fs_path) end
commit()
click to toggle source
# File lib/zksync/archive.rb, line 46 def commit @file_index.write end
file_at_path(archive_path)
click to toggle source
# File lib/zksync/archive.rb, line 50 def file_at_path(archive_path) @file_index.file_at_path(archive_path) end
inode_for_path(archive_path)
click to toggle source
# File lib/zksync/archive.rb, line 54 def inode_for_path(archive_path) @file_index.inode_for_path(archive_path) end
list()
click to toggle source
list of all archive paths in this archive
# File lib/zksync/archive.rb, line 38 def list @file_index.list end
rm(*archive_paths)
click to toggle source
# File lib/zksync/archive.rb, line 42 def rm(*archive_paths) archive_paths.each { |archive_path| @file_index.rm(archive_path) } end