Add keyboard_layout stanza.
				
					
				
			This commit is contained in:
		
							parent
							
								
									d43ba7c306
								
							
						
					
					
						commit
						3da305fa80
					
				@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user