2017-02-20 09:42:43 -08:00
|
|
|
require "requirement"
|
|
|
|
|
|
|
|
class OsxfuseRequirement < Requirement
|
|
|
|
download "https://github.com/libfuse/libfuse"
|
|
|
|
|
|
|
|
satisfy(build_env: false) do
|
|
|
|
next true if libfuse_formula_exists? && Formula["libfuse"].installed?
|
2018-09-17 02:45:00 +02:00
|
|
|
|
2017-02-20 09:42:43 -08:00
|
|
|
includedirs = %w[
|
|
|
|
/usr/include
|
|
|
|
/usr/local/include
|
|
|
|
]
|
|
|
|
next true if (includedirs.map do |dir|
|
|
|
|
File.exist? "#{dir}/fuse.h"
|
|
|
|
end).any?
|
2018-09-17 02:45:00 +02:00
|
|
|
|
2017-02-20 09:42:43 -08:00
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def message
|
|
|
|
msg = "libfuse is required to install this formula.\n"
|
|
|
|
if libfuse_formula_exists?
|
2017-10-15 02:28:32 +02:00
|
|
|
msg + <<~EOS
|
2019-04-05 12:24:10 -04:00
|
|
|
Run `brew install libfuse` to install it.
|
2017-02-20 09:42:43 -08:00
|
|
|
EOS
|
|
|
|
else
|
|
|
|
msg + super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def libfuse_formula_exists?
|
|
|
|
begin
|
|
|
|
Formula["libfuse"]
|
|
|
|
rescue FormulaUnavailableError
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|