simplify cached_formula_json_file check
This commit is contained in:
parent
8993ebca88
commit
9f27bd4c67
@ -30,10 +30,8 @@ module Homebrew
|
|||||||
def all_formulae
|
def all_formulae
|
||||||
@all_formulae ||= begin
|
@all_formulae ||= begin
|
||||||
curl_args = %w[--compressed --silent https://formulae.brew.sh/api/formula.json]
|
curl_args = %w[--compressed --silent https://formulae.brew.sh/api/formula.json]
|
||||||
if cached_formula_json_file.exist?
|
if cached_formula_json_file.exist? && !cached_formula_json_file.empty?
|
||||||
last_modified = cached_formula_json_file.mtime.utc
|
curl_args.prepend("--time-cond", cached_formula_json_file)
|
||||||
last_modified = last_modified.strftime("%a, %d %b %Y %H:%M:%S GMT")
|
|
||||||
curl_args = ["--time-cond", last_modified, *curl_args] unless cached_formula_json_file.empty?
|
|
||||||
end
|
end
|
||||||
curl_download(*curl_args, to: HOMEBREW_CACHE_API/"#{formula_api_path}.json", max_time: 5)
|
curl_download(*curl_args, to: HOMEBREW_CACHE_API/"#{formula_api_path}.json", max_time: 5)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user