small refactor to check env variable within function

This commit is contained in:
lionellloh 2020-07-07 21:42:22 +08:00
parent c855429612
commit 5449904dde
2 changed files with 4 additions and 2 deletions

View File

@ -259,7 +259,7 @@ module Homebrew
formulae.each do |f| formulae.each do |f|
Migrator.migrate_if_needed(f) Migrator.migrate_if_needed(f)
forbidden_license_check(f) unless ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank? forbidden_license_check(f)
install_formula(f) install_formula(f)
Cleanup.install_formula_clean!(f) Cleanup.install_formula_clean!(f)
end end
@ -348,6 +348,8 @@ module Homebrew
end end
def forbidden_license_check(f) def forbidden_license_check(f)
return if ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank?
forbidden_licenses = env_forbidden_licenses forbidden_licenses = env_forbidden_licenses
if forbidden_licenses.include? f.license if forbidden_licenses.include? f.license

View File

@ -149,7 +149,7 @@ 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? Homebrew.forbidden_license_check(formula)
check_install_sanity check_install_sanity
end end