aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/config.rb
blob: 43408d53d3be02167c297b2e127bacbbc2172da0 (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
module Hbc
  class Config
    def self.global
      @global ||= new
    end

    attr_reader :binarydir

    def initialize(
      appdir:               "/Applications",
      prefpanedir:          "~/Library/PreferencePanes",
      qlplugindir:          "~/Library/QuickLook",
      dictionarydir:        "~/Library/Dictionaries",
      fontdir:              "~/Library/Fonts",
      colorpickerdir:       "~/Library/ColorPickers",
      servicedir:           "~/Library/Services",
      input_methoddir:      "~/Library/Input Methods",
      internet_plugindir:   "~/Library/Internet Plug-Ins",
      audio_unit_plugindir: "~/Library/Audio/Plug-Ins/Components",
      vst_plugindir:        "~/Library/Audio/Plug-Ins/VST",
      vst3_plugindir:       "~/Library/Audio/Plug-Ins/VST3",
      screen_saverdir:      "~/Library/Screen Savers"
    )

      self.appdir               = appdir
      self.prefpanedir          = prefpanedir
      self.qlplugindir          = qlplugindir
      self.dictionarydir        = dictionarydir
      self.fontdir              = fontdir
      self.colorpickerdir       = colorpickerdir
      self.servicedir           = servicedir
      self.input_methoddir      = input_methoddir
      self.internet_plugindir   = internet_plugindir
      self.audio_unit_plugindir = audio_unit_plugindir
      self.vst_plugindir        = vst_plugindir
      self.vst3_plugindir       = vst3_plugindir
      self.screen_saverdir      = screen_saverdir

      # `binarydir` is not customisable.
      @binarydir = HOMEBREW_PREFIX/"bin"
    end

    [
      :appdir,
      :prefpanedir,
      :qlplugindir,
      :dictionarydir,
      :fontdir,
      :colorpickerdir,
      :servicedir,
      :input_methoddir,
      :internet_plugindir,
      :audio_unit_plugindir,
      :vst_plugindir,
      :vst3_plugindir,
      :screen_saverdir,
    ].each do |dir|
      attr_reader dir

      define_method(:"#{dir}=") do |path|
        instance_variable_set(:"@#{dir}", Pathname(path).expand_path)
      end
    end
  end
end