homebrew-cask-versions/lib/hbc/container/air.rb
ndr 83bf761588 Improve error message for AIR app reinstallation
Adobe AIR Installer forbids the silent reinstallation of existing AIR
apps; any attempt fails with exit code 9.

In the absence of known workarounds, we merely wrap the failure in a
clearer error message.
2015-01-04 11:46:26 +00:00

35 lines
1,021 B
Ruby

class Hbc::Container::Air < Hbc::Container::Base
def self.me?(criteria)
%w[.air].include?(criteria.path.extname)
end
def self.installer_cmd
@installer_cmd ||= if installer_exist?
_installer_pathname
else
raise Hbc::CaskError.new <<-ERRMSG.undent
Adobe AIR runtime not present, try installing it via
brew cask install adobe-air
ERRMSG
end
end
def self.installer_exist?
_installer_pathname.exist?
end
def self._installer_pathname
@_installer_pathname ||= Pathname.new('/Applications/Utilities/Adobe AIR Application Installer.app/Contents/MacOS/Adobe AIR Application Installer')
end
def extract
install = @command.run(self.class.installer_cmd,
:args => ['-silent', '-location', @cask.staged_path, Pathname.new(@path).realpath])
if install.exit_status == 9 then
raise Hbc::CaskError.new "Adobe AIR application #{@cask} already exists on the system, and cannot be reinstalled."
end
end
end