aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/auditor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/auditor.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/auditor.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/auditor.rb b/Library/Homebrew/cask/lib/hbc/auditor.rb
index 6b0c1c476..ee1b50938 100644
--- a/Library/Homebrew/cask/lib/hbc/auditor.rb
+++ b/Library/Homebrew/cask/lib/hbc/auditor.rb
@@ -1,6 +1,23 @@
module Hbc
class Auditor
def self.audit(cask, audit_download: false, check_token_conflicts: false)
+ saved_languages = MacOS.instance_variable_get(:@languages)
+
+ if languages_blocks = cask.instance_variable_get(:@dsl).instance_variable_get(:@language_blocks)
+ languages_blocks.keys.each do |languages|
+ ohai "Auditing language: #{languages.map { |lang| "'#{lang}'" }.join(", ")}"
+ MacOS.instance_variable_set(:@languages, languages)
+ audit_cask_instance(Hbc.load(cask.sourcefile_path), audit_download, check_token_conflicts)
+ CLI::Cleanup.run(cask.token) if audit_download
+ end
+ else
+ audit_cask_instance(cask, audit_download, check_token_conflicts)
+ end
+ ensure
+ MacOS.instance_variable_set(:@languages, saved_languages)
+ end
+
+ def self.audit_cask_instance(cask, audit_download, check_token_conflicts)
download = audit_download && Download.new(cask)
audit = Audit.new(cask, download: download,
check_token_conflicts: check_token_conflicts)