| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: false | 
					
						
							| 
									
										
										
										
											2019-05-24 21:36:48 -03:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-03 00:13:50 +00:00
										 |  |  | # The Library/Homebrew/extend/os/software_spec.rb conditional logic will need to be more nuanced | 
					
						
							|  |  |  | # if this file ever includes more than `uses_from_macos`. | 
					
						
							| 
									
										
										
										
											2019-05-24 21:36:48 -03:00
										 |  |  | class SoftwareSpec | 
					
						
							| 
									
										
										
										
											2019-05-26 00:17:40 -03:00
										 |  |  |   undef uses_from_macos | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 14:17:54 +01:00
										 |  |  |   def uses_from_macos(deps, bounds = {}) | 
					
						
							| 
									
										
										
										
											2019-09-17 18:10:02 -04:00
										 |  |  |     @uses_from_macos_elements ||= [] | 
					
						
							| 
									
										
										
										
											2020-04-28 14:17:54 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if deps.is_a?(Hash) | 
					
						
							|  |  |  |       bounds = deps.dup | 
					
						
							| 
									
										
										
										
											2021-02-16 09:25:34 +00:00
										 |  |  |       deps = bounds.shift | 
					
						
							| 
									
										
										
										
											2020-04-28 14:17:54 +01:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-04 17:16:39 +01:00
										 |  |  |     bounds = bounds.transform_values { |v| MacOS::Version.from_symbol(v) } | 
					
						
							| 
									
										
										
										
											2021-03-03 00:30:40 +00:00
										 |  |  |     if MacOS.version >= bounds[:since] || | 
					
						
							|  |  |  |        (Homebrew::EnvConfig.simulate_macos_on_linux? && !bounds.key?(:since)) | 
					
						
							| 
									
										
										
										
											2020-04-28 14:17:54 +01:00
										 |  |  |       @uses_from_macos_elements << deps | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       depends_on deps | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2019-05-24 21:36:48 -03:00
										 |  |  |   end | 
					
						
							|  |  |  | end |