@@ -264,13 +264,9 @@ def download(quiet: nil, timeout: nil)
264264
265265 sig { returns ( UnpackStrategy ) }
266266 def primary_container
267- @primary_container ||= T . let (
268- begin
269- downloaded_path = download ( quiet : true )
270- UnpackStrategy . detect ( downloaded_path , type : @cask . container &.type , merge_xattrs : true )
271- end ,
272- T . nilable ( UnpackStrategy ) ,
273- )
267+ download ( quiet : true ) if @cask . download . nil?
268+
269+ downloader . primary_container
274270 end
275271
276272 sig { returns ( ArtifactSet ) }
@@ -280,46 +276,12 @@ def artifacts
280276
281277 sig { params ( to : Pathname ) . void }
282278 def extract_primary_container ( to : @cask . staged_path )
283- odebug "Extracting primary container"
284-
285- container = primary_container
286- raise "unexpected nil primary_container" unless container
287-
288- odebug "Using container class #{ container . class } for #{ container . path } "
289-
290- basename = downloader . basename
291-
292- if ( nested_container = @cask . container &.nested )
293- Dir . mktmpdir ( "cask-installer" , HOMEBREW_TEMP ) do |tmpdir |
294- tmpdir = Pathname ( tmpdir )
295- container . extract ( to : tmpdir , basename :, verbose : verbose? )
296-
297- FileUtils . chmod_R "+rw" , tmpdir /nested_container , force : true , verbose : verbose?
298-
299- UnpackStrategy . detect ( tmpdir /nested_container , merge_xattrs : true )
300- . extract_nestedly ( to :, verbose : verbose? )
301- end
302- else
303- container . extract_nestedly ( to :, basename :, verbose : verbose? )
304- end
305-
306- return unless quarantine?
307- return unless Quarantine . available?
308-
309- Quarantine . propagate ( from : container . path , to :)
279+ downloader . extract_primary_container ( to :, verbose : verbose? )
310280 end
311281
312282 sig { params ( target_dir : T . nilable ( Pathname ) ) . void }
313283 def process_rename_operations ( target_dir : nil )
314- return if @cask . rename . empty?
315-
316- working_dir = target_dir || @cask . staged_path
317- odebug "Processing rename operations in #{ working_dir } "
318-
319- @cask . rename . each do |rename_operation |
320- odebug "Renaming #{ rename_operation . from } to #{ rename_operation . to } "
321- rename_operation . perform_rename ( working_dir )
322- end
284+ downloader . process_rename_operations ( target_dir : target_dir || @cask . staged_path )
323285 end
324286
325287 sig { params ( predecessor : T . nilable ( Cask ) ) . void }
0 commit comments