brew/Library/Homebrew/cask/lib/hbc/artifact/nested_container.rb
2017-06-14 02:06:25 +02:00

25 lines
712 B
Ruby

require "hbc/artifact/base"
module Hbc
module Artifact
class NestedContainer < Base
def install_phase
@cask.artifacts[:nested_container].each { |container| extract(container) }
end
def extract(container_relative_path)
source = @cask.staged_path.join(container_relative_path)
container = Container.for_path(source, @command)
unless container
raise CaskError, "Aw dang, could not identify nested container at '#{source}'"
end
ohai "Extracting nested container #{source.basename}"
container.new(@cask, source, @command, verbose: verbose?).extract
FileUtils.remove_entry_secure(source)
end
end
end
end