aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/artifact.rb
blob: 074d15017a23dbc8e7fc856279541690865480e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require "hbc/artifact/app"
require "hbc/artifact/artifact" # generic 'artifact' stanza
require "hbc/artifact/binary"
require "hbc/artifact/colorpicker"
require "hbc/artifact/dictionary"
require "hbc/artifact/font"
require "hbc/artifact/input_method"
require "hbc/artifact/installer"
require "hbc/artifact/internet_plugin"
require "hbc/artifact/audio_unit_plugin"
require "hbc/artifact/vst_plugin"
require "hbc/artifact/vst3_plugin"
require "hbc/artifact/nested_container"
require "hbc/artifact/pkg"
require "hbc/artifact/postflight_block"
require "hbc/artifact/preflight_block"
require "hbc/artifact/prefpane"
require "hbc/artifact/qlplugin"
require "hbc/artifact/screen_saver"
require "hbc/artifact/service"
require "hbc/artifact/stage_only"
require "hbc/artifact/suite"
require "hbc/artifact/uninstall"
require "hbc/artifact/zap"

module Hbc
  module Artifact
    # NOTE: Order is important here!
    #
    # The `uninstall` stanza should be run first, as it may
    # depend on other artifacts still being installed.
    #
    # We want to extract nested containers before we
    # handle any other artifacts.
    #
    TYPES = [
      PreflightBlock,
      Uninstall,
      NestedContainer,
      Installer,
      App,
      Suite,
      Artifact, # generic 'artifact' stanza
      Colorpicker,
      Pkg,
      Prefpane,
      Qlplugin,
      Dictionary,
      Font,
      Service,
      StageOnly,
      Binary,
      InputMethod,
      InternetPlugin,
      AudioUnitPlugin,
      VstPlugin,
      Vst3Plugin,
      ScreenSaver,
      PostflightBlock,
      Zap,
    ].freeze

    def self.for_cask(cask, options = {})
      odebug "Determining which artifacts are present in Cask #{cask}"

      TYPES
        .select { |klass| klass.me?(cask) }
        .map { |klass| klass.new(cask, options) }
    end
  end
end