@@ -25,20 +25,25 @@ def self.formula_json(name)
2525 cache . fetch ( "formula_json" ) . fetch ( name )
2626 end
2727
28- sig { params ( name : String , download_queue : T . nilable ( DownloadQueue ) ) . void }
29- def self . fetch_formula_json! ( name , download_queue : nil )
28+ sig { params ( name : String ) . void }
29+ def self . fetch_formula_json! ( name )
3030 endpoint = "formula/#{ name } .json"
31- json_formula , updated = Homebrew ::API . fetch_json_api_file endpoint , download_queue : download_queue
32- return if download_queue
31+ json_formula , updated = Homebrew ::API . fetch_json_api_file endpoint
3332
3433 json_formula = JSON . parse ( ( HOMEBREW_CACHE_API /endpoint ) . read ) unless updated
3534
3635 cache [ "formula_json" ] ||= { }
3736 cache [ "formula_json" ] [ name ] = json_formula
3837 end
3938
40- sig { params ( formula : ::Formula , download_queue : T . nilable ( Homebrew ::DownloadQueue ) ) . returns ( Homebrew ::API ::SourceDownload ) }
41- def self . source_download ( formula , download_queue : nil )
39+ sig {
40+ params (
41+ formula : ::Formula ,
42+ download_queue : Homebrew ::DownloadQueue ,
43+ enqueue : T ::Boolean ,
44+ ) . returns ( Homebrew ::API ::SourceDownload )
45+ }
46+ def self . source_download ( formula , download_queue : Homebrew . default_download_queue , enqueue : false )
4247 path = formula . ruby_source_path || "Formula/#{ formula . name } .rb"
4348 git_head = formula . tap_git_head || "HEAD"
4449 tap = formula . tap &.full_name || "Homebrew/homebrew-core"
@@ -49,7 +54,7 @@ def self.source_download(formula, download_queue: nil)
4954 cache : HOMEBREW_CACHE_API_SOURCE /"#{ tap } /#{ git_head } /Formula" ,
5055 )
5156
52- if download_queue
57+ if enqueue
5358 download_queue . enqueue ( download )
5459 elsif !download . symlink_location . exist?
5560 download . fetch
@@ -76,19 +81,20 @@ def self.cached_json_file_path
7681 end
7782
7883 sig {
79- params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) , stale_seconds : T . nilable ( Integer ) )
84+ params ( download_queue : Homebrew ::DownloadQueue , stale_seconds : T . nilable ( Integer ) , enqueue : T :: Boolean )
8085 . returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
8186 }
82- def self . fetch_api! ( download_queue : nil , stale_seconds : nil )
83- Homebrew ::API . fetch_json_api_file DEFAULT_API_FILENAME , stale_seconds :, download_queue :
87+ def self . fetch_api! ( download_queue : Homebrew . default_download_queue , stale_seconds : nil , enqueue : false )
88+ Homebrew ::API . fetch_json_api_file DEFAULT_API_FILENAME , stale_seconds :, download_queue :, enqueue :
8489 end
8590
8691 sig {
87- params ( download_queue : T . nilable ( Homebrew ::DownloadQueue ) , stale_seconds : T . nilable ( Integer ) )
92+ params ( download_queue : Homebrew ::DownloadQueue , stale_seconds : T . nilable ( Integer ) , enqueue : T :: Boolean )
8893 . returns ( [ T . any ( T ::Array [ T . untyped ] , T ::Hash [ String , T . untyped ] ) , T ::Boolean ] )
8994 }
90- def self . fetch_tap_migrations! ( download_queue : nil , stale_seconds : nil )
91- Homebrew ::API . fetch_json_api_file "formula_tap_migrations.jws.json" , stale_seconds :, download_queue :
95+ def self . fetch_tap_migrations! ( download_queue : Homebrew . default_download_queue , stale_seconds : nil ,
96+ enqueue : false )
97+ Homebrew ::API . fetch_json_api_file "formula_tap_migrations.jws.json" , stale_seconds :, download_queue :, enqueue :
9298 end
9399
94100 sig { returns ( T ::Boolean ) }
0 commit comments