forbidden-license: include method in module scope for module-wide access
This commit is contained in:
parent
d24f911410
commit
a161829927
@ -342,10 +342,13 @@ module Homebrew
|
|||||||
rescue CannotInstallFormulaError => e
|
rescue CannotInstallFormulaError => e
|
||||||
ofail e.message
|
ofail e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_forbidden_licenses
|
||||||
|
Homebrew::EnvConfig.forbidden_licenses.split(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
def forbidden_license_check(f)
|
def forbidden_license_check(f)
|
||||||
forbidden_licenses = ENV["HOMEBREW_FORBIDDEN_LICENSES"].split(" ")
|
forbidden_licenses = get_forbidden_licenses
|
||||||
|
|
||||||
if forbidden_licenses.include? f.license
|
if forbidden_licenses.include? f.license
|
||||||
raise CannotInstallFormulaError, <<~EOS
|
raise CannotInstallFormulaError, <<~EOS
|
||||||
@ -363,3 +366,7 @@ def forbidden_license_check(f)
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -148,6 +148,8 @@ class FormulaInstaller
|
|||||||
def prelude
|
def prelude
|
||||||
Tab.clear_cache
|
Tab.clear_cache
|
||||||
verify_deps_exist unless ignore_deps?
|
verify_deps_exist unless ignore_deps?
|
||||||
|
Homebrew.forbidden_license_check(formula) unless ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank?
|
||||||
|
|
||||||
check_install_sanity
|
check_install_sanity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user