Document Artifact.

This commit is contained in:
Markus Reiter 2020-08-19 10:23:41 +02:00
parent a3065080c3
commit 5426e47579
32 changed files with 98 additions and 0 deletions

View File

@ -27,6 +27,9 @@ require "cask/artifact/uninstall"
require "cask/artifact/zap"
module Cask
# Module containing all cask artifact classes.
#
# @api private
module Artifact
end
end

View File

@ -2,6 +2,9 @@
module Cask
module Artifact
# Abstract superclass for all artifacts.
#
# @api private
class AbstractArtifact
include Comparable
extend Predicable

View File

@ -4,6 +4,9 @@ require "cask/artifact/abstract_artifact"
module Cask
module Artifact
# Abstract superclass for block artifacts.
#
# @api private
class AbstractFlightBlock < AbstractArtifact
def self.dsl_key
super.to_s.sub(/_block$/, "").to_sym

View File

@ -10,6 +10,9 @@ using HashValidator
module Cask
module Artifact
# Abstract superclass for uninstall artifacts.
#
# @api private
class AbstractUninstall < AbstractArtifact
ORDERED_DIRECTIVES = [
:early_script,

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `app` stanza.
#
# @api private
class App < Moved
end
end

View File

@ -7,6 +7,9 @@ using HashValidator
module Cask
module Artifact
# Generic artifact corresponding to the `artifact` stanza.
#
# @api private
class Artifact < Moved
def self.english_name
"Generic Artifact"

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `audio_unit_plugin` stanza.
#
# @api private
class AudioUnitPlugin < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/symlinked"
module Cask
module Artifact
# Artifact corresponding to the `binary` stanza.
#
# @api private
class Binary < Symlinked
def link(command: nil, **options)
super(command: command, **options)

View File

@ -3,6 +3,9 @@
require "cask/artifact/moved"
module Cask
# Artifact corresponding to the `colorpicker` stanza.
#
# @api private
module Artifact
class Colorpicker < Moved
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `dictionary` stanza.
#
# @api private
class Dictionary < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `font` stanza.
#
# @api private
class Font < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `input_method` stanza.
#
# @api private
class InputMethod < Moved
end
end

View File

@ -7,12 +7,16 @@ using HashValidator
module Cask
module Artifact
# Artifact corresponding to the `installer` stanza.
#
# @api private
class Installer < AbstractArtifact
VALID_KEYS = Set.new([
:manual,
:script,
]).freeze
# Extension module for manual installers.
module ManualInstaller
def install_phase(**)
puts <<~EOS
@ -23,6 +27,7 @@ module Cask
end
end
# Extension module for script installers.
module ScriptInstaller
def install_phase(command: nil, **_)
ohai "Running #{self.class.dsl_key} script '#{path}'"

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `internet_plugin` stanza.
#
# @api private
class InternetPlugin < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/symlinked"
module Cask
module Artifact
# Artifact corresponding to the `manpage` stanza.
#
# @api private
class Manpage < Symlinked
attr_reader :section

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `mdimporter` stanza.
#
# @api private
class Mdimporter < Moved
def self.english_name
"Spotlight metadata importer"

View File

@ -4,6 +4,9 @@ require "cask/artifact/relocated"
module Cask
module Artifact
# Superclass for all artifacts which are installed by moving them to the target location.
#
# @api private
class Moved < Relocated
def self.english_description
"#{english_name}s"

View File

@ -10,6 +10,9 @@ using HashValidator
module Cask
module Artifact
# Artifact corresponding to the `pkg` stanza.
#
# @api private
class Pkg < AbstractArtifact
attr_reader :pkg_relative_path, :path, :stanza_options

View File

@ -4,6 +4,9 @@ require "cask/artifact/abstract_flight_block"
module Cask
module Artifact
# Artifact corresponding to the `postflight` stanza.
#
# @api private
class PostflightBlock < AbstractFlightBlock
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/abstract_flight_block"
module Cask
module Artifact
# Artifact corresponding to the `preflight` stanza.
#
# @api private
class PreflightBlock < AbstractFlightBlock
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `prefpane` stanza.
#
# @api private
class Prefpane < Moved
def self.english_name
"Preference Pane"

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `qlplugin` stanza.
#
# @api private
class Qlplugin < Moved
def self.english_name
"QuickLook Plugin"

View File

@ -7,6 +7,9 @@ using HashValidator
module Cask
module Artifact
# Superclass for all artifacts which have a source and a target location.
#
# @api private
class Relocated < AbstractArtifact
def self.from_args(cask, *args)
source_string, target_hash = args

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `screen_saver` stanza.
#
# @api private
class ScreenSaver < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `service` stanza.
#
# @api private
class Service < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/abstract_artifact"
module Cask
module Artifact
# Artifact corresponding to the `stage_only` stanza.
#
# @api private
class StageOnly < AbstractArtifact
def self.from_args(cask, *args)
raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true") if args != [true]

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `suite` stanza.
#
# @api private
class Suite < Moved
def self.english_name
"App Suite"

View File

@ -4,6 +4,9 @@ require "cask/artifact/relocated"
module Cask
module Artifact
# Superclass for all artifacts which are installed by symlinking them to the target location.
#
# @api private
class Symlinked < Relocated
def self.link_type_english_name
"Symlink"

View File

@ -4,6 +4,9 @@ require "cask/artifact/abstract_uninstall"
module Cask
module Artifact
# Artifact corresponding to the `uninstall` stanza.
#
# @api private
class Uninstall < AbstractUninstall
def uninstall_phase(**options)
ORDERED_DIRECTIVES.reject { |directive_sym| directive_sym == :rmdir }

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `vst3_plugin` stanza.
#
# @api private
class Vst3Plugin < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/moved"
module Cask
module Artifact
# Artifact corresponding to the `vst_plugin` stanza.
#
# @api private
class VstPlugin < Moved
end
end

View File

@ -4,6 +4,9 @@ require "cask/artifact/abstract_uninstall"
module Cask
module Artifact
# Artifact corresponding to the `zap` stanza.
#
# @api private
class Zap < AbstractUninstall
def zap_phase(**options)
dispatch_uninstall_directives(**options)