| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-23 16:38:06 +00:00
										 |  |  | require "requirement" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ArchRequirement < Requirement | 
					
						
							|  |  |  |   fatal true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-19 16:38:41 +01:00
										 |  |  |   def initialize(tags) | 
					
						
							|  |  |  |     @arch = tags.shift | 
					
						
							|  |  |  |     super(tags) | 
					
						
							| 
									
										
										
										
											2017-12-23 16:38:06 +00:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   satisfy(build_env: false) do | 
					
						
							|  |  |  |     case @arch | 
					
						
							| 
									
										
										
										
											2019-01-08 19:13:46 +00:00
										 |  |  |     when :x86_64 then Hardware::CPU.is_64_bit? | 
					
						
							| 
									
										
										
										
											2017-12-23 16:38:06 +00:00
										 |  |  |     when :intel, :ppc then Hardware::CPU.type == @arch | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message | 
					
						
							|  |  |  |     "This formula requires an #{@arch} architecture." | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2019-03-11 20:30:11 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def display_s | 
					
						
							|  |  |  |     "#{@arch} architecture" | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2017-12-23 16:38:06 +00:00
										 |  |  | end |