| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: false | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  | require "delegate" | 
					
						
							| 
									
										
										
										
											2020-07-30 12:59:01 -04:00
										 |  |  | require "cask_dependent" | 
					
						
							| 
									
										
										
										
											2013-01-07 14:06:34 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-14 03:52:11 +02:00
										 |  |  | # A collection of dependencies. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # @api private | 
					
						
							| 
									
										
										
										
											2020-09-20 05:50:33 +02:00
										 |  |  | class Dependencies < SimpleDelegator | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   extend T::Sig | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |   def initialize(*args) | 
					
						
							|  |  |  |     super(args) | 
					
						
							| 
									
										
										
										
											2013-01-07 14:06:34 -06:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |   alias eql? == | 
					
						
							| 
									
										
										
										
											2013-05-10 23:45:06 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def optional | 
					
						
							|  |  |  |     select(&:optional?) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def recommended | 
					
						
							|  |  |  |     select(&:recommended?) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def build | 
					
						
							|  |  |  |     select(&:build?) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def required | 
					
						
							|  |  |  |     select(&:required?) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def default | 
					
						
							|  |  |  |     build + required + recommended | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2014-02-13 16:31:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   sig { returns(String) } | 
					
						
							| 
									
										
										
										
											2014-11-20 22:29:23 -06:00
										 |  |  |   def inspect | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |     "#<#{self.class.name}: #{to_a}>" | 
					
						
							| 
									
										
										
										
											2014-11-20 22:29:23 -06:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-10-24 18:17:43 -05:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2014-07-03 14:50:57 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-14 03:52:11 +02:00
										 |  |  | # A collection of requirements. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # @api private | 
					
						
							| 
									
										
										
										
											2020-09-20 05:50:33 +02:00
										 |  |  | class Requirements < SimpleDelegator | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   extend T::Sig | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |   def initialize(*args) | 
					
						
							|  |  |  |     super(Set.new(args)) | 
					
						
							| 
									
										
										
										
											2014-07-03 14:50:57 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def <<(other) | 
					
						
							| 
									
										
										
										
											2016-09-20 22:03:08 +02:00
										 |  |  |     if other.is_a?(Comparable) | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |       grep(other.class) do |req| | 
					
						
							| 
									
										
										
										
											2014-07-03 14:50:57 -05:00
										 |  |  |         return self if req > other | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |         delete(req) | 
					
						
							| 
									
										
										
										
											2014-07-03 14:50:57 -05:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |     super | 
					
						
							| 
									
										
										
										
											2014-07-03 14:50:57 -05:00
										 |  |  |     self | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |   sig { returns(String) } | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |   def inspect | 
					
						
							|  |  |  |     "#<#{self.class.name}: {#{to_a.join(", ")}}>" | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2014-07-03 14:50:57 -05:00
										 |  |  | end |