Skip to content

Commit

Permalink
Merge pull request #13089 from steveh7812/fetch-from-api
Browse files Browse the repository at this point in the history
set `prefer_loading_from_api: true` for `brew fetch`
  • Loading branch information
MikeMcQuaid committed Apr 7, 2022
2 parents be83857 + dda9f75 commit 9c58f9a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Library/Homebrew/cmd/fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,26 @@ def fetch
args = fetch_args.parse

bucket = if args.deps?
args.named.to_formulae_and_casks.flat_map do |formula_or_cask|
args.named.to_formulae_and_casks(prefer_loading_from_api: true).flat_map do |formula_or_cask|
case formula_or_cask
when Formula
f = formula_or_cask

[f, *f.recursive_dependencies.map(&:to_formula)]
deps = if Homebrew::EnvConfig.install_from_api?
f.recursive_dependencies do |_, dependency|
Dependency.prune if EnvConfig.install_from_api? && (dependency.build? || dependency.test?)
end
else
f.recursive_dependencies
end

[f, *deps.map(&:to_formula)]
else
formula_or_cask
end
end
else
args.named.to_formulae_and_casks
args.named.to_formulae_and_casks(prefer_loading_from_api: true)
end.uniq

puts "Fetching: #{bucket * ", "}" if bucket.size > 1
Expand Down

0 comments on commit 9c58f9a

Please sign in to comment.