| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-10 17:53:31 +02:00
										 |  |  | require "system_command" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-19 07:35:50 +02:00
										 |  |  | module SystemConfig | 
					
						
							| 
									
										
										
										
											2016-04-25 18:01:15 +01:00
										 |  |  |   class << self | 
					
						
							| 
									
										
										
										
											2020-10-10 17:53:31 +02:00
										 |  |  |     include SystemCommand::Mixin | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-12 03:09:59 +00:00
										 |  |  |     undef describe_clang | 
					
						
							| 
									
										
										
										
											2016-04-25 18:01:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-12 03:09:59 +00:00
										 |  |  |     sig { returns(String) } | 
					
						
							| 
									
										
										
										
											2021-10-07 11:24:20 +08:00
										 |  |  |     def describe_clang | 
					
						
							|  |  |  |       return "N/A" if clang.null? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       clang_build_info = clang_build.null? ? "(parse error)" : clang_build | 
					
						
							|  |  |  |       "#{clang} build #{clang_build_info}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-07 20:28:56 +01:00
										 |  |  |     def xcode | 
					
						
							|  |  |  |       @xcode ||= if MacOS::Xcode.installed? | 
					
						
							|  |  |  |         xcode = MacOS::Xcode.version.to_s | 
					
						
							|  |  |  |         xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix? | 
					
						
							|  |  |  |         xcode | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def clt | 
					
						
							| 
									
										
										
										
											2019-02-19 13:11:32 +00:00
										 |  |  |       @clt ||= MacOS::CLT.version if MacOS::CLT.installed? | 
					
						
							| 
									
										
										
										
											2018-04-07 20:28:56 +01:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-21 22:54:38 -08:00
										 |  |  |     def core_tap_config(out = $stdout) | 
					
						
							|  |  |  |       dump_tap_config(CoreTap.instance, out) | 
					
						
							|  |  |  |       dump_tap_config(CoreCaskTap.instance, out) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-10 23:46:07 +00:00
										 |  |  |     def dump_verbose_config(out = $stdout) | 
					
						
							|  |  |  |       dump_generic_verbose_config(out) | 
					
						
							|  |  |  |       out.puts "macOS: #{MacOS.full_version}-#{kernel}" | 
					
						
							|  |  |  |       out.puts "CLT: #{clt || "N/A"}" | 
					
						
							|  |  |  |       out.puts "Xcode: #{xcode || "N/A"}" | 
					
						
							|  |  |  |       out.puts "Rosetta 2: #{Hardware::CPU.in_rosetta2?}" if Hardware::CPU.physical_cpu_arm64? | 
					
						
							| 
									
										
										
										
											2016-04-25 18:01:15 +01:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |