Class: S3Repo::Metadata
- Inherits:
-
Base
- Object
- Base
- S3Repo::Metadata
show all
- Defined in:
- lib/s3repo/metadata.rb
Overview
Metadata object, represents repo’s DB file
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Constructor Details
This class inherits a constructor from S3Repo::Base
Instance Method Details
#add_packages(paths) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/s3repo/metadata.rb', line 8
def add_packages(paths)
@db_path = nil
paths.each do |path|
puts "Adding #{File.basename(path)} to repo.db"
run("repo-add #{db_path} #{path}")
end
update!
end
|
#packages ⇒ Object
31
32
33
34
35
|
# File 'lib/s3repo/metadata.rb', line 31
def packages
return @packages if @packages
cmd = "bsdtar tf #{db_path}"
@packages = run(cmd).split.map { |x| x.split('/').first }.uniq
end
|
#remove_packages(packages) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/s3repo/metadata.rb', line 17
def remove_packages(packages)
@db_path = nil
packages.each do |package|
puts "Removing #{package} from repo.db"
run("repo-remove #{db_path} #{package}")
end
update!
end
|
#update! ⇒ Object
26
27
28
29
|
# File 'lib/s3repo/metadata.rb', line 26
def update!
sign_db if @options[:sign_db]
db_names.each { |x| client.upload_file(x, db_path) }
end
|