38 lines
945 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: true
2018-07-24 18:43:20 +02:00
# frozen_string_literal: true
module UnpackStrategy
2020-08-09 06:09:05 +02:00
# Strategy for unpacking Adobe Air archives.
class Air
include UnpackStrategy
using Magic
def self.extensions
[".air"]
end
def self.can_extract?(path)
2018-07-29 10:25:31 +02:00
mime_type = "application/vnd.adobe.air-application-installer-package+zip"
path.magic_number.match?(/.{59}#{Regexp.escape(mime_type)}/)
end
def dependencies
2018-09-06 08:29:14 +02:00
@dependencies ||= [Cask::CaskLoader.load("adobe-air")]
end
2018-07-24 18:43:20 +02:00
AIR_APPLICATION_INSTALLER =
"/Applications/Utilities/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer"
private_constant :AIR_APPLICATION_INSTALLER
private
def extract_to_dir(unpack_dir, basename:, verbose:)
2018-07-24 18:43:20 +02:00
system_command! AIR_APPLICATION_INSTALLER,
2018-11-02 17:18:07 +00:00
args: ["-silent", "-location", unpack_dir, path],
2018-07-24 18:43:20 +02:00
verbose: verbose
end
end
end