linux/bundle/skipper: add support for Linux casks.
Don't unconditionally skip Linux casks but instead check if they are supported on Linux.
This commit is contained in:
parent
2dbce6bac5
commit
08a9b44b72
@ -6,17 +6,30 @@ module OS
|
|||||||
module Bundle
|
module Bundle
|
||||||
module Skipper
|
module Skipper
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
sig { params(entry: Homebrew::Bundle::Dsl::Entry).returns(T::Boolean) }
|
||||||
def macos_only_entry?(entry)
|
def macos_only_entry?(entry)
|
||||||
[:cask, :mas].include?(entry.type)
|
entry.type == :mas
|
||||||
end
|
end
|
||||||
|
|
||||||
def macos_only_tap?(entry)
|
sig { params(entry: Homebrew::Bundle::Dsl::Entry).returns(T::Boolean) }
|
||||||
entry.type == :tap && entry.name == "homebrew/cask"
|
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
|
||||||
|
|
||||||
|
true
|
||||||
|
rescue ::Cask::CaskError
|
||||||
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def skip?(entry, silent: false)
|
def skip?(entry, silent: false)
|
||||||
if macos_only_entry?(entry) || macos_only_tap?(entry)
|
if macos_only_entry?(entry) || macos_only_cask?(entry)
|
||||||
::Kernel.puts Formatter.warning "Skipping #{entry.type} #{entry.name} (on Linux)" unless silent
|
unless silent
|
||||||
|
$stdout.puts Formatter.warning "Skipping #{entry.type} #{entry.name} (unsupported on Linux)"
|
||||||
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
super(entry)
|
super(entry)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user