| 
									
										
										
										
											2025-04-19 22:22:42 +01:00
										 |  |  | # typed: strict | 
					
						
							| 
									
										
										
										
											2025-03-18 17:38:37 +00:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-25 19:11:19 +00:00
										 |  |  | require "cask/cask_loader" | 
					
						
							|  |  |  | require "cask/installer" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-18 17:38:37 +00:00
										 |  |  | module OS | 
					
						
							|  |  |  |   module Linux | 
					
						
							|  |  |  |     module Bundle | 
					
						
							|  |  |  |       module Skipper | 
					
						
							|  |  |  |         module ClassMethods | 
					
						
							| 
									
										
										
										
											2025-03-25 11:08:21 +00:00
										 |  |  |           sig { params(entry: Homebrew::Bundle::Dsl::Entry).returns(T::Boolean) } | 
					
						
							| 
									
										
										
										
											2025-03-18 17:38:37 +00:00
										 |  |  |           def macos_only_entry?(entry) | 
					
						
							| 
									
										
										
										
											2025-03-25 11:08:21 +00:00
										 |  |  |             entry.type == :mas | 
					
						
							| 
									
										
										
										
											2025-03-18 17:38:37 +00:00
										 |  |  |           end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-25 11:08:21 +00:00
										 |  |  |           sig { params(entry: Homebrew::Bundle::Dsl::Entry).returns(T::Boolean) } | 
					
						
							|  |  |  |           def macos_only_cask?(entry) | 
					
						
							|  |  |  |             return false if entry.type != :cask | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             cask = ::Cask::CaskLoader.load(entry.name) | 
					
						
							|  |  |  |             installer = ::Cask::Installer.new(cask) | 
					
						
							|  |  |  |             installer.check_stanza_os_requirements | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             false | 
					
						
							| 
									
										
										
										
											2025-03-27 11:49:10 +00:00
										 |  |  |           rescue ::Cask::CaskError | 
					
						
							|  |  |  |             true | 
					
						
							| 
									
										
										
										
											2025-03-18 17:38:37 +00:00
										 |  |  |           end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-19 22:22:42 +01:00
										 |  |  |           sig { params(entry: Homebrew::Bundle::Dsl::Entry, silent: T::Boolean).returns(T::Boolean) } | 
					
						
							| 
									
										
										
										
											2025-03-18 17:38:37 +00:00
										 |  |  |           def skip?(entry, silent: false) | 
					
						
							| 
									
										
										
										
											2025-03-25 11:08:21 +00:00
										 |  |  |             if macos_only_entry?(entry) || macos_only_cask?(entry) | 
					
						
							|  |  |  |               unless silent | 
					
						
							|  |  |  |                 $stdout.puts Formatter.warning "Skipping #{entry.type} #{entry.name} (unsupported on Linux)" | 
					
						
							|  |  |  |               end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-18 17:38:37 +00:00
										 |  |  |               true | 
					
						
							|  |  |  |             else | 
					
						
							|  |  |  |               super(entry) | 
					
						
							|  |  |  |             end | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Homebrew::Bundle::Skipper.singleton_class.prepend(OS::Linux::Bundle::Skipper::ClassMethods) |