Change command / method from sign -> digest. One day, we'll have signtures from keys / certs.
This commit is contained in:
@@ -15,13 +15,13 @@ module Picopackage
|
|||||||
dir = argv.first || '.'
|
dir = argv.first || '.'
|
||||||
Picopackage::Scanner.scan(dir).each {|f| puts f.file_path }
|
Picopackage::Scanner.scan(dir).each {|f| puts f.file_path }
|
||||||
|
|
||||||
when 'sign'
|
when 'digest'
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = "Usage: ppkg sign FILE"
|
opts.banner = "Usage: ppkg digest FILE"
|
||||||
end.parse!(argv)
|
end.parse!(argv)
|
||||||
|
|
||||||
file = argv.first
|
file = argv.first
|
||||||
Picopackage::SourceFile.from_file(file).sign
|
Picopackage::SourceFile.from_file(file).digest!
|
||||||
|
|
||||||
when 'checksum'
|
when 'checksum'
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ module Picopackage
|
|||||||
else
|
else
|
||||||
source_file.save(destination)
|
source_file.save(destination)
|
||||||
if source_file.imported?
|
if source_file.imported?
|
||||||
source_file.sign
|
source_file.digest!
|
||||||
puts "Picopackage created for #{source_file.filename}"
|
puts "Picopackage created for #{source_file.filename}"
|
||||||
else
|
else
|
||||||
puts "Picopackage downloaded to #{file_path}"
|
puts "Picopackage downloaded to #{file_path}"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module Picopackage
|
|||||||
|
|
||||||
updated_metadata = metadata.merge(instance.metadata)
|
updated_metadata = metadata.merge(instance.metadata)
|
||||||
|
|
||||||
## For new Picopackages, we should add metadata and sign
|
## For new Picopackages, we should add metadata and checksum
|
||||||
instance.update_metadata(updated_metadata)
|
instance.update_metadata(updated_metadata)
|
||||||
|
|
||||||
instance
|
instance
|
||||||
@@ -68,9 +68,9 @@ module Picopackage
|
|||||||
@content = generate_content
|
@content = generate_content
|
||||||
end
|
end
|
||||||
|
|
||||||
def sign
|
def digest!
|
||||||
hash = checksum
|
hash = checksum
|
||||||
return puts "File already signed" if metadata['content_checksum'] == hash
|
return puts "File already has a checksum" if metadata['content_checksum'] == hash
|
||||||
|
|
||||||
new_metadata = metadata.merge('content_checksum' => hash)
|
new_metadata = metadata.merge('content_checksum' => hash)
|
||||||
update_metadata(new_metadata)
|
update_metadata(new_metadata)
|
||||||
|
|||||||
Reference in New Issue
Block a user