diff --git a/Library/Homebrew/cask/caskroom.rb b/Library/Homebrew/cask/caskroom.rb index 5da099578558840778ac91079bf13846876ec7aa..e2b3841c365ba04d30a63f3c27a6897ade0bd76c 100644 --- a/Library/Homebrew/cask/caskroom.rb +++ b/Library/Homebrew/cask/caskroom.rb @@ -29,18 +29,18 @@ module Cask SystemCommand.run("/usr/bin/chgrp", args: ["admin", path], sudo: sudo) end - def casks + def casks(config: nil) return [] unless path.exist? Pathname.glob(path.join("*")).sort.select(&:directory?).map do |path| token = path.basename.to_s if tap_path = CaskLoader.tap_paths(token).first - CaskLoader::FromTapPathLoader.new(tap_path).load(config: nil) + CaskLoader::FromTapPathLoader.new(tap_path).load(config: config) elsif caskroom_path = Pathname.glob(path.join(".metadata/*/*/*/*.rb")).first - CaskLoader::FromPathLoader.new(caskroom_path).load(config: nil) + CaskLoader::FromPathLoader.new(caskroom_path).load(config: config) else - CaskLoader.load(token) + CaskLoader.load(token, config: config) end end end diff --git a/Library/Homebrew/cask/cmd/list.rb b/Library/Homebrew/cask/cmd/list.rb index 55f6e937cd6ba1cba2bc63bc3b365e03a0c5b032..208464eda9d166d6fb1bcff1a6f4df0b6749ab87 100644 --- a/Library/Homebrew/cask/cmd/list.rb +++ b/Library/Homebrew/cask/cmd/list.rb @@ -32,16 +32,17 @@ module Cask one: args.public_send(:'1?'), full_name: args.full_name?, versions: args.versions?, + args: args, ) end - def self.list_casks(*casks, json: false, one: false, full_name: false, versions: false) + def self.list_casks(*casks, args:, json: false, one: false, full_name: false, versions: false) output = if casks.any? casks.each do |cask| raise CaskNotInstalledError, cask unless cask.installed? end else - Caskroom.casks + Caskroom.casks(config: Config.from_args(args)) end if json diff --git a/Library/Homebrew/cask/cmd/outdated.rb b/Library/Homebrew/cask/cmd/outdated.rb index c84a1358a4cdc25960ae0de9f52d67ea33d50b38..231648c09f49ddc086291546eddf4d4a4ac427e6 100644 --- a/Library/Homebrew/cask/cmd/outdated.rb +++ b/Library/Homebrew/cask/cmd/outdated.rb @@ -20,7 +20,7 @@ module Cask end def run - outdated_casks = casks(alternative: -> { Caskroom.casks }).select do |cask| + outdated_casks = casks(alternative: -> { Caskroom.casks(config: Config.from_args(args)) }).select do |cask| odebug "Checking update info of Cask #{cask}" cask.outdated?(greedy: args.greedy?) end diff --git a/Library/Homebrew/cask/cmd/upgrade.rb b/Library/Homebrew/cask/cmd/upgrade.rb index 6e58348438a26f2edee37a643b654b9f0e1c0d68..2f0d183288046b514bded4dfee0cbeaac602bd50 100644 --- a/Library/Homebrew/cask/cmd/upgrade.rb +++ b/Library/Homebrew/cask/cmd/upgrade.rb @@ -38,11 +38,13 @@ module Cask require_sha: args.require_sha?, skip_cask_deps: args.skip_cask_deps?, verbose: verbose, + args: args, ) end def self.upgrade_casks( *casks, + args:, force: false, greedy: false, dry_run: false, @@ -56,7 +58,7 @@ module Cask quarantine = true if quarantine.nil? outdated_casks = if casks.empty? - Caskroom.casks.select do |cask| + Caskroom.casks(config: Config.from_args(args)).select do |cask| cask.outdated?(greedy: greedy) end else diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 4f6f46325b7f758ffacd1826676387cc0533ac78..2a99942008e48ea619e6033a6bd36878b40b90dd 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -78,7 +78,7 @@ module Homebrew dependents = if args.named.present? sorted_dependents(args.named.to_formulae_and_casks) elsif args.installed? - sorted_dependents(Formula.installed + Cask::Caskroom.casks) + sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args))) else raise FormulaUnspecifiedError end @@ -96,7 +96,8 @@ module Homebrew if args.no_named? raise FormulaUnspecifiedError unless args.installed? - puts_deps sorted_dependents(Formula.installed + Cask::Caskroom.casks), recursive: recursive, args: args + puts_deps sorted_dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args))), + recursive: recursive, args: args return end diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 435ddc58439a955055204177cf218454c6f504a3..3e55a883372a044df0c2b8bb6269bb5530c2d30f 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -172,6 +172,7 @@ module Homebrew one: args.public_send(:'1?'), full_name: args.full_name?, versions: args.versions?, + args: args, ) end end diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index e1a26b7f151976dd36c629808667c89953643994..e6f148d8fba9fac51a5030dae9458c693f16e63b 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -176,7 +176,7 @@ module Homebrew if args.named.present? select_outdated(args.named.to_casks, args: args) else - select_outdated(Cask::Caskroom.casks, args: args) + select_outdated(Cask::Caskroom.casks(config: Cask::Config.from_args(args)), args: args) end end @@ -185,7 +185,7 @@ module Homebrew if formulae.blank? && casks.blank? formulae = Formula.installed - casks = Cask::Caskroom.casks + casks = Cask::Caskroom.casks(config: Cask::Config.from_args(args)) end [select_outdated(formulae, args: args).sort, select_outdated(casks, args: args)] diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index c18ad05108405f71af94b369df624bc39c8a4369..a65fd1459ffdb2714f1f9a71679f95f52db9912d 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -157,6 +157,7 @@ module Homebrew require_sha: EnvConfig.cask_opts_require_sha?, skip_cask_deps: args.skip_cask_deps?, verbose: args.verbose?, + args: args, ) end end diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index d9085b745f5c3eccdc2621367d6b2ee770f5a49b..b63dc064bb0777cba31a904f49a89d0c8649c24a 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -78,10 +78,13 @@ module Homebrew used_formulae.map(&:runtime_installed_formula_dependents) .reduce(&:&) .select(&:any_version_installed?) + - select_used_dependents(dependents(Cask::Caskroom.casks), used_formulae, recursive, includes, ignores) + select_used_dependents( + dependents(Cask::Caskroom.casks(config: Cask::Config.from_args(args))), + used_formulae, recursive, includes, ignores + ) else deps = if args.installed? - dependents(Formula.installed + Cask::Caskroom.casks) + dependents(Formula.installed + Cask::Caskroom.casks(config: Cask::Config.from_args(args))) else dependents(Formula.to_a + Cask::Cask.to_a) end