| 
									
										
										
										
											2023-03-26 08:10:40 +02:00
										 |  |  | # 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 | 
					
						
							|  |  |  |       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, **_) | 
					
						
							| 
									
										
										
										
											2023-03-27 14:06:07 -07:00
										 |  |  |         command.run!( | 
					
						
							|  |  |  |           "/bin/rm", | 
					
						
							|  |  |  |           args:         ["-f", "--", "/System/Library/Caches/com.apple.IntlDataCache.le*"], | 
					
						
							|  |  |  |           sudo:         true, | 
					
						
							|  |  |  |           sudo_as_root: true, | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2023-03-26 08:10:40 +02:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |