brew/Library/Homebrew/requirements/tuntap_requirement.rb
Mike McQuaid 87dd13aea6
Deprecate cask requirements.
This probably has to wait until 2.7.0 now and will require a bunch of
formula changes/deprecations but we should probably start moving in this
direction given we're not installing any of these on our CI any more.
2020-12-15 14:19:45 +00:00

31 lines
670 B
Ruby

# typed: false
# frozen_string_literal: true
require "requirement"
# A requirement on TunTap for macOS.
#
# @api private
class TuntapRequirement < Requirement
extend T::Sig
def initialize(tags = [])
odeprecated "depends_on :tuntap"
super(tags)
end
fatal true
cask "tuntap"
satisfy(build_env: false) { self.class.binary_tuntap_installed? }
sig { returns(T::Boolean) }
def self.binary_tuntap_installed?
%w[
/Library/Extensions/tun.kext
/Library/Extensions/tap.kext
/Library/LaunchDaemons/net.sf.tuntaposx.tun.plist
/Library/LaunchDaemons/net.sf.tuntaposx.tap.plist
].all? { |file| File.exist?(file) }
end
end