lib/s3repo/metadata.rb in s3repo-2.0.1 vs lib/s3repo/metadata.rb in s3repo-2.0.2
- old
+ new
@@ -23,32 +23,44 @@
update!
end
def update!
sign_db if @options[:sign_db]
- client.upload_file('repo.db', db_path)
- client.upload_file('repo.db.tar.xz', db_path)
+ db_names.each { |x| client.upload_file(x, db_path) }
end
def packages
return @packages if @packages
cmd = "bsdtar tf #{db_path}"
@packages = run(cmd).split.map { |x| x.split('/').first }.uniq
end
private
+ def repo_name
+ @options[:repo_name] || raise('No repo name given')
+ end
+
+ def db_names
+ @db_names ||= ['repo', repo_name].flat_map do |x|
+ [x + '.db', x + '.db.tar.xz']
+ end
+ end
+
+ def sig_names
+ @sig_names ||= db_names.map { |x| x + '.sig' }
+ end
+
def signer
@options[:signer] ||= Signer.new(@options)
end
def sign_db
sig_path = signer.sign(db_path)
- client.upload_file('repo.db.sig', sig_path)
- client.upload_file('repo.db.tar.xz.sig', sig_path)
+ sig_names.each { |x| client.upload_file(x, sig_path) }
end
def db_path
- @db_path ||= file_cache.download('repo.db.tar.xz')
+ @db_path ||= file_cache.download(db_names.first)
end
end
end