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
|
||||
ofail e.message
|
||||
end
|
||||
|
||||
def get_forbidden_licenses
|
||||
Homebrew::EnvConfig.forbidden_licenses.split(" ")
|
||||
end
|
||||
|
||||
def forbidden_license_check(f)
|
||||
forbidden_licenses = ENV["HOMEBREW_FORBIDDEN_LICENSES"].split(" ")
|
||||
forbidden_licenses = get_forbidden_licenses
|
||||
|
||||
if forbidden_licenses.include? f.license
|
||||
raise CannotInstallFormulaError, <<~EOS
|
||||
@ -363,3 +366,7 @@ def forbidden_license_check(f)
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@ -148,6 +148,8 @@ class FormulaInstaller
|
||||
def prelude
|
||||
Tab.clear_cache
|
||||
verify_deps_exist unless ignore_deps?
|
||||
Homebrew.forbidden_license_check(formula) unless ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank?
|
||||
|
||||
check_install_sanity
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user