Class: Gemvault::LegacyTarvault
Overview
Read-only reader for a format-2 vault: a tarball whose index is the
manifest.json gemvault wrote through 0.2.x. It exists so gemvault upgrade
migrates such a vault through the same pipeline every other format takes,
rather than leaving the gems stranded behind an error.
It does not read that manifest. The index is derived from the payload
instead: each stored .gem carries its own gemspec, which is where the
manifest's identity fields came from in the first place. That keeps the
old notation from re-entering the codebase to be parsed (issue #25) and
makes the reader indifferent to a manifest that is damaged or missing.
Two things the old index held are consequently gone. Each gem's stored
time is unrecoverable, so entries are stamped when the vault is opened;
and the per-gem digests cannot be checked, so a migrated gem is trusted as
the bytes found in the archive -- the new vault records fresh digests of
exactly what it copied.
Constant Summary
collapse
- FORMAT_VERSION =
2
Instance Attribute Summary collapse
Instance Method Summary
collapse
open
#spec_from_blob, #specs, #with_gem_file
Constructor Details
Returns a new instance of LegacyTarvault.
41
42
43
44
45
46
|
# File 'lib/gemvault/legacy_tarvault.rb', line 41
def initialize(path)
@path = Pathname(path).expand_path
@archive = Tarball.new(@path)
@closed = false
open_vault!
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
39
40
41
|
# File 'lib/gemvault/legacy_tarvault.rb', line 39
def path
@path
end
|
Instance Method Details
#add ⇒ Object
48
49
50
|
# File 'lib/gemvault/legacy_tarvault.rb', line 48
def add(*)
raise Vault::ReadOnlyError, read_only_message
end
|
#close ⇒ Object
71
72
73
|
# File 'lib/gemvault/legacy_tarvault.rb', line 71
def close
@closed = true
end
|
#closed? ⇒ Boolean
75
|
# File 'lib/gemvault/legacy_tarvault.rb', line 75
def closed? = @closed
|
67
|
# File 'lib/gemvault/legacy_tarvault.rb', line 67
def format_version = FORMAT_VERSION
|
#gem_data(entry) ⇒ Object
56
57
58
59
60
61
|
# File 'lib/gemvault/legacy_tarvault.rb', line 56
def gem_data(entry)
bytes = @archive.read(entry.filename)
raise Vault::NotFoundError, "Gem not found: #{entry}" unless bytes
bytes
end
|
#gem_entries ⇒ Object
63
64
65
|
# File 'lib/gemvault/legacy_tarvault.rb', line 63
def gem_entries
@gem_entries ||= derived_entries
end
|
#remove ⇒ Object
52
53
54
|
# File 'lib/gemvault/legacy_tarvault.rb', line 52
def remove(*)
raise Vault::ReadOnlyError, read_only_message
end
|
#size ⇒ Object
69
|
# File 'lib/gemvault/legacy_tarvault.rb', line 69
def size = gem_members.size
|