From 5449904ddefcf3cd8bdbf5574d7d5e87b47bacaa Mon Sep 17 00:00:00 2001 From: lionellloh Date: Tue, 7 Jul 2020 21:42:22 +0800 Subject: [PATCH] small refactor to check env variable within function --- Library/Homebrew/cmd/install.rb | 4 +++- Library/Homebrew/formula_installer.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index e4ec708c0b..41d31be6a9 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -259,7 +259,7 @@ module Homebrew formulae.each do |f| Migrator.migrate_if_needed(f) - forbidden_license_check(f) unless ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank? + forbidden_license_check(f) install_formula(f) Cleanup.install_formula_clean!(f) end @@ -348,6 +348,8 @@ module Homebrew end def forbidden_license_check(f) + return if ENV["HOMEBREW_FORBIDDEN_LICENSES"].blank? + forbidden_licenses = env_forbidden_licenses if forbidden_licenses.include? f.license diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 7a9da2a595..73f452eca0 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -149,7 +149,7 @@ class FormulaInstaller def prelude Tab.clear_cache 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 end