Merge pull request #4534 from reitermarkus/remove-gpg-container
Remove `Hbc::Container::Gpg`.
This commit is contained in:
commit
2c9dc62d35
@ -8,7 +8,6 @@ require "hbc/container/dmg"
|
||||
require "hbc/container/self_extracting_executable"
|
||||
require "hbc/container/executable"
|
||||
require "hbc/container/generic_unar"
|
||||
require "hbc/container/gpg"
|
||||
require "hbc/container/gzip"
|
||||
require "hbc/container/lzma"
|
||||
require "hbc/container/naked"
|
||||
@ -45,7 +44,6 @@ module Hbc
|
||||
Gzip, # pure gzip
|
||||
Lzma, # pure lzma
|
||||
Xz, # pure xz
|
||||
Gpg, # GnuPG signed data
|
||||
Executable,
|
||||
SvnRepository,
|
||||
]
|
||||
|
@ -1,43 +0,0 @@
|
||||
require "hbc/container/base"
|
||||
|
||||
module Hbc
|
||||
class Container
|
||||
class Gpg < Base
|
||||
def self.can_extract?(path:, magic_number:)
|
||||
path.extname == ".gpg"
|
||||
end
|
||||
|
||||
def import_key
|
||||
if @cask.gpg.nil?
|
||||
raise CaskError, "Expected to find gpg public key in formula. Cask '#{@cask}' must add: 'gpg :embedded, key_id: [Public Key ID]' or 'gpg :embedded, key_url: [Public Key URL]'"
|
||||
end
|
||||
|
||||
args = if @cask.gpg.key_id
|
||||
["--recv-keys", @cask.gpg.key_id]
|
||||
elsif @cask.gpg.key_url
|
||||
["--fetch-key", @cask.gpg.key_url.to_s]
|
||||
end
|
||||
|
||||
@command.run!("gpg",
|
||||
args: args,
|
||||
env: { "PATH" => PATH.new(Formula["gnupg"].opt_bin, ENV["PATH"]) })
|
||||
end
|
||||
|
||||
def extract_to_dir(unpack_dir, basename:, verbose:)
|
||||
import_key
|
||||
|
||||
Dir.mktmpdir do |tmp_unpack_dir|
|
||||
@command.run!("gpg",
|
||||
args: ["--batch", "--yes", "--output", Pathname(tmp_unpack_dir).join(basename.basename(".gpg")), "--decrypt", path],
|
||||
env: { "PATH" => PATH.new(Formula["gnupg"].opt_bin, ENV["PATH"]) })
|
||||
|
||||
extract_nested_inside(tmp_unpack_dir, to: unpack_dir)
|
||||
end
|
||||
end
|
||||
|
||||
def dependencies
|
||||
@dependencies ||= [Formula["gnupg"]]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user