| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: false | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-06 08:29:14 +02:00
										 |  |  | module Cask | 
					
						
							| 
									
										
										
										
											2018-09-04 08:45:48 +01:00
										 |  |  |   class Cmd | 
					
						
							| 
									
										
										
										
											2021-01-25 09:18:10 +00:00
										 |  |  |     # Cask implementation of the `brew fetch` command. | 
					
						
							| 
									
										
										
										
											2020-08-19 10:34:07 +02:00
										 |  |  |     # | 
					
						
							|  |  |  |     # @api private | 
					
						
							| 
									
										
										
										
											2017-05-20 19:08:03 +02:00
										 |  |  |     class Fetch < AbstractCommand | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |       extend T::Sig | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 02:30:46 +02:00
										 |  |  |       def self.parser | 
					
						
							|  |  |  |         super do | 
					
						
							|  |  |  |           switch "--force", | 
					
						
							|  |  |  |                  description: "Force redownloading even if files already exist in local cache." | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2017-05-21 00:15:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |       sig { void } | 
					
						
							| 
									
										
										
										
											2017-05-21 00:15:56 +02:00
										 |  |  |       def run | 
					
						
							| 
									
										
										
										
											2020-08-18 00:23:23 +01:00
										 |  |  |         require "cask/download" | 
					
						
							|  |  |  |         require "cask/installer" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 02:30:46 +02:00
										 |  |  |         options = { | 
					
						
							|  |  |  |           quarantine: args.quarantine?, | 
					
						
							|  |  |  |         }.compact | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         options[:quarantine] = true if options[:quarantine].nil? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-13 17:14:01 +02:00
										 |  |  |         casks.each do |cask| | 
					
						
							| 
									
										
										
										
											2019-03-11 21:20:02 -04:00
										 |  |  |           puts Installer.caveats(cask) | 
					
						
							| 
									
										
										
										
											2017-06-13 17:14:01 +02:00
										 |  |  |           ohai "Downloading external files for Cask #{cask}" | 
					
						
							| 
									
										
										
										
											2020-11-19 18:12:16 +01:00
										 |  |  |           download = Download.new(cask, **options) | 
					
						
							|  |  |  |           download.clear_cache if args.force? | 
					
						
							|  |  |  |           downloaded_path = download.fetch | 
					
						
							| 
									
										
										
										
											2020-07-06 15:31:47 -04:00
										 |  |  |           ohai "Success! Downloaded to: #{downloaded_path}" | 
					
						
							| 
									
										
										
										
											2016-09-24 13:52:43 +02:00
										 |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2016-08-18 22:11:42 +03:00
										 |  |  |   end | 
					
						
							|  |  |  | end |