Fetch new API
This commit is contained in:
parent
0f9fb4f29a
commit
fe3aec30bb
@ -152,6 +152,30 @@ module Homebrew
|
||||
json.except("variations")
|
||||
end
|
||||
|
||||
sig { params(download_queue: T.nilable(DownloadQueue), stale_seconds: Integer).void }
|
||||
def self.fetch_api_files!(download_queue: nil, stale_seconds: Homebrew::EnvConfig.api_auto_update_secs.to_i)
|
||||
if ENV.fetch("HOMEBREW_USE_INTERNAL_API", false).present?
|
||||
Homebrew::API::Internal.fetch_formula_api!(download_queue:, stale_seconds:)
|
||||
Homebrew::API::Internal.fetch_cask_api!(download_queue:, stale_seconds:)
|
||||
else
|
||||
Homebrew::API::Formula.fetch_api!(download_queue:, stale_seconds:)
|
||||
Homebrew::API::Formula.fetch_tap_migrations!(download_queue:, stale_seconds:)
|
||||
Homebrew::API::Cask.fetch_api!(download_queue:, stale_seconds:)
|
||||
Homebrew::API::Cask.fetch_tap_migrations!(download_queue:, stale_seconds:)
|
||||
end
|
||||
end
|
||||
|
||||
sig { void }
|
||||
def self.write_names_and_aliases
|
||||
if ENV.fetch("HOMEBREW_USE_INTERNAL_API", nil)
|
||||
Homebrew::API::Internal.write_formula_names_and_aliases
|
||||
Homebrew::API::Internal.write_cask_names
|
||||
else
|
||||
Homebrew::API::Formula.write_names_and_aliases
|
||||
Homebrew::API::Cask.write_names
|
||||
end
|
||||
end
|
||||
|
||||
sig { params(names: T::Array[String], type: String, regenerate: T::Boolean).returns(T::Boolean) }
|
||||
def self.write_names_file!(names, type, regenerate:)
|
||||
names_path = HOMEBREW_CACHE_API/"#{type}_names.txt"
|
||||
|
||||
@ -95,10 +95,7 @@ begin
|
||||
require "api/cask"
|
||||
download_queue = Homebrew::DownloadQueue.new
|
||||
stale_seconds = 86400 # 1 day
|
||||
Homebrew::API::Formula.fetch_api!(download_queue:, stale_seconds:)
|
||||
Homebrew::API::Formula.fetch_tap_migrations!(download_queue:, stale_seconds:)
|
||||
Homebrew::API::Cask.fetch_api!(download_queue:, stale_seconds:)
|
||||
Homebrew::API::Cask.fetch_tap_migrations!(download_queue:, stale_seconds:)
|
||||
Homebrew::API.fetch_api_files!(download_queue:, stale_seconds:)
|
||||
begin
|
||||
download_queue.fetch
|
||||
ensure
|
||||
|
||||
@ -134,10 +134,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
# Check if we can parse the JSON and do any Ruby-side follow-up.
|
||||
unless Homebrew::EnvConfig.no_install_from_api?
|
||||
Homebrew::API::Formula.write_names_and_aliases
|
||||
Homebrew::API::Cask.write_names
|
||||
end
|
||||
Homebrew::API.write_names_and_aliases unless Homebrew::EnvConfig.no_install_from_api?
|
||||
|
||||
Homebrew.failed = true if ENV["HOMEBREW_UPDATE_FAILED"]
|
||||
return if Homebrew::EnvConfig.disable_load_formula?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user