Merge pull request #15061 from reitermarkus/keyboard-layout
Add `keyboard_layout` stanza.
This commit is contained in:
commit
cf6614b50e
@ -11,6 +11,7 @@ require "cask/artifact/font"
|
||||
require "cask/artifact/input_method"
|
||||
require "cask/artifact/installer"
|
||||
require "cask/artifact/internet_plugin"
|
||||
require "cask/artifact/keyboard_layout"
|
||||
require "cask/artifact/manpage"
|
||||
require "cask/artifact/vst_plugin"
|
||||
require "cask/artifact/vst3_plugin"
|
||||
|
||||
36
Library/Homebrew/cask/artifact/keyboard_layout.rb
Normal file
36
Library/Homebrew/cask/artifact/keyboard_layout.rb
Normal file
@ -0,0 +1,36 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cask/artifact/moved"
|
||||
|
||||
module Cask
|
||||
module Artifact
|
||||
# Artifact corresponding to the `keyboard_layout` stanza.
|
||||
#
|
||||
# @api private
|
||||
class KeyboardLayout < Moved
|
||||
extend T::Sig
|
||||
|
||||
sig { returns(String) }
|
||||
def self.english_name
|
||||
"Keyboard Layout"
|
||||
end
|
||||
|
||||
def install_phase(**options)
|
||||
super(**options)
|
||||
delete_keyboard_layout_cache(**options)
|
||||
end
|
||||
|
||||
def uninstall_phase(**options)
|
||||
super(**options)
|
||||
delete_keyboard_layout_cache(**options)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def delete_keyboard_layout_cache(command: nil, **_)
|
||||
command.run!("/bin/rm", args: ["-f", "--", "/System/Library/Caches/com.apple.IntlDataCache.le*"], sudo: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -15,6 +15,7 @@ module Cask
|
||||
|
||||
DEFAULT_DIRS = {
|
||||
appdir: "/Applications",
|
||||
keyboard_layoutdir: "/Library/Keyboard Layouts",
|
||||
colorpickerdir: "~/Library/ColorPickers",
|
||||
prefpanedir: "~/Library/PreferencePanes",
|
||||
qlplugindir: "~/Library/QuickLook",
|
||||
@ -40,6 +41,7 @@ module Cask
|
||||
def self.from_args(args)
|
||||
new(explicit: {
|
||||
appdir: args.appdir,
|
||||
keyboard_layoutdir: args.keyboard_layoutdir,
|
||||
colorpickerdir: args.colorpickerdir,
|
||||
prefpanedir: args.prefpanedir,
|
||||
qlplugindir: args.qlplugindir,
|
||||
|
||||
@ -44,6 +44,7 @@ module Cask
|
||||
Artifact::Font,
|
||||
Artifact::InputMethod,
|
||||
Artifact::InternetPlugin,
|
||||
Artifact::KeyboardLayout,
|
||||
Artifact::Manpage,
|
||||
Artifact::Pkg,
|
||||
Artifact::Prefpane,
|
||||
|
||||
@ -273,6 +273,9 @@ module Homebrew
|
||||
sig { returns(T.nilable(String)) }
|
||||
def appdir; end
|
||||
|
||||
sig { returns(T.nilable(String)) }
|
||||
def keyboard_layoutdir; end
|
||||
|
||||
sig { returns(T.nilable(String)) }
|
||||
def fontdir; end
|
||||
|
||||
|
||||
@ -37,6 +37,10 @@ module Homebrew
|
||||
description: "Target location for Applications " \
|
||||
"(default: `#{Cask::Config::DEFAULT_DIRS[:appdir]}`).",
|
||||
}],
|
||||
[:flag, "--keyboard-layoutdir=", {
|
||||
description: "Target location for Keyboard Layouts " \
|
||||
"(default: `#{Cask::Config::DEFAULT_DIRS[:keyboard_layoutdir]}`).",
|
||||
}],
|
||||
[:flag, "--colorpickerdir=", {
|
||||
description: "Target location for Color Pickers " \
|
||||
"(default: `#{Cask::Config::DEFAULT_DIRS[:colorpickerdir]}`).",
|
||||
|
||||
@ -29,6 +29,7 @@ module RuboCop
|
||||
:font,
|
||||
:input_method,
|
||||
:internet_plugin,
|
||||
:keyboard_layout,
|
||||
:prefpane,
|
||||
:qlplugin,
|
||||
:mdimporter,
|
||||
|
||||
@ -3007,6 +3007,10 @@ class Cask::Config
|
||||
|
||||
def internet_plugindir=(path); end
|
||||
|
||||
def keyboard_layoutdir(); end
|
||||
|
||||
def keyboard_layoutdir=(path); end
|
||||
|
||||
def mdimporterdir(); end
|
||||
|
||||
def mdimporterdir=(path); end
|
||||
@ -6554,6 +6558,8 @@ class RuboCop::Cask::AST::Stanza
|
||||
|
||||
def internet_plugin?(); end
|
||||
|
||||
def keyboard_layout?(); end
|
||||
|
||||
def language?(); end
|
||||
|
||||
def livecheck?(); end
|
||||
|
||||
@ -11,6 +11,7 @@ module Cask
|
||||
class Config
|
||||
DEFAULT_DIRS_PATHNAMES = {
|
||||
appdir: Pathname(TEST_TMPDIR)/"cask-appdir",
|
||||
keyboard_layoutdir: Pathname(TEST_TMPDIR)/"cask-keyboard-layoutdir",
|
||||
prefpanedir: Pathname(TEST_TMPDIR)/"cask-prefpanedir",
|
||||
qlplugindir: Pathname(TEST_TMPDIR)/"cask-qlplugindir",
|
||||
mdimporterdir: Pathname(TEST_TMPDIR)/"cask-mdimporter",
|
||||
|
||||
@ -31,6 +31,11 @@ module Homebrew
|
||||
@apps ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }
|
||||
end
|
||||
|
||||
sig { returns(T::Array[Cask::Artifact::Qlplugin]) }
|
||||
def keyboard_layouts
|
||||
@keyboard_layouts ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::KeyboardLayout) }
|
||||
end
|
||||
|
||||
sig { returns(T::Array[Cask::Artifact::Qlplugin]) }
|
||||
def qlplugins
|
||||
@qlplugins ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Qlplugin) }
|
||||
@ -93,7 +98,7 @@ module Homebrew
|
||||
|
||||
installer.extract_primary_container(to: dir)
|
||||
|
||||
info_plist_paths = apps.concat(qlplugins, installers).flat_map do |artifact|
|
||||
info_plist_paths = apps.concat(keyboard_layouts, qlplugins, installers).flat_map do |artifact|
|
||||
source = artifact.is_a?(Cask::Artifact::Installer) ? artifact.path : artifact.source.basename
|
||||
top_level_info_plists(Pathname.glob(dir/"**"/source/"Contents"/"Info.plist")).sort
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user