New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add keyboard_layout
stanza.
#15061
Add keyboard_layout
stanza.
#15061
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
Comment on lines
+31
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to take a command argument if it's always going to run the same command? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I looked at the other artifacts and see that this is a common pattern. I wonder why it accepts nil as an argument though since it seems to be required here and I couldn't find any references where the command would be nil in the cask installer. |
||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,6 +15,7 @@ class Config | |||||
|
||||||
DEFAULT_DIRS = { | ||||||
appdir: "/Applications", | ||||||
keyboard_layoutdir: "/Library/Keyboard Layouts", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional. You will need |
||||||
colorpickerdir: "~/Library/ColorPickers", | ||||||
prefpanedir: "~/Library/PreferencePanes", | ||||||
qlplugindir: "~/Library/QuickLook", | ||||||
|
@@ -40,6 +41,7 @@ def self.defaults | |||||
def self.from_args(args) | ||||||
new(explicit: { | ||||||
appdir: args.appdir, | ||||||
keyboard_layoutdir: args.keyboard_layoutdir, | ||||||
colorpickerdir: args.colorpickerdir, | ||||||
prefpanedir: args.prefpanedir, | ||||||
qlplugindir: args.qlplugindir, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is always necessary to delete the layout cache on both install and uninstall? The PR linked to in the
homebrew/cask
repo only shows that this is done for one cask.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, https://www.kaufmann.no/roland/dvorak/macosx.html shows its removal in both installation and removal instructions.