| 
									
										
										
										
											2023-03-05 18:18:59 +00:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2021-01-21 12:34:04 +00:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-30 18:57:50 +00:00
										 |  |  | homebrew_bootsnap_enabled = ENV["HOMEBREW_NO_BOOTSNAP"].nil? && !ENV["HOMEBREW_BOOTSNAP"].nil? | 
					
						
							| 
									
										
										
										
											2021-02-25 15:59:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-05 17:08:55 +01:00
										 |  |  | # we need some development tools to build bootsnap native code | 
					
						
							| 
									
										
										
										
											2021-02-25 15:59:17 +00:00
										 |  |  | homebrew_bootsnap_enabled &&= if ENV["HOMEBREW_MACOS_VERSION"] | 
					
						
							| 
									
										
										
										
											2023-10-05 17:08:55 +01:00
										 |  |  |   File.directory?("/Applications/Xcode.app") || File.directory?("/Library/Developer/CommandLineTools") | 
					
						
							| 
									
										
										
										
											2021-02-24 16:49:06 +00:00
										 |  |  | else | 
					
						
							|  |  |  |   File.executable?("/usr/bin/clang") || File.executable?("/usr/bin/gcc") | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-25 15:59:17 +00:00
										 |  |  | if homebrew_bootsnap_enabled | 
					
						
							| 
									
										
										
										
											2021-02-02 11:50:44 +00:00
										 |  |  |   begin | 
					
						
							|  |  |  |     require "bootsnap" | 
					
						
							|  |  |  |   rescue LoadError | 
					
						
							| 
									
										
										
										
											2021-02-05 15:43:55 +00:00
										 |  |  |     unless ENV["HOMEBREW_BOOTSNAP_RETRY"] | 
					
						
							| 
									
										
										
										
											2023-09-04 21:52:51 +01:00
										 |  |  |       Homebrew.install_bundler_gems!(groups: ["bootsnap"], only_warn_on_failure: true) | 
					
						
							| 
									
										
										
										
											2021-01-21 16:31:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-05 15:43:55 +00:00
										 |  |  |       ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1" | 
					
						
							| 
									
										
										
										
											2022-05-30 04:37:09 +01:00
										 |  |  |       exec ENV.fetch("HOMEBREW_BREW_FILE"), *ARGV | 
					
						
							| 
									
										
										
										
											2021-02-05 15:43:55 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2021-01-21 16:31:35 +00:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-02 11:50:44 +00:00
										 |  |  |   ENV.delete("HOMEBREW_BOOTSNAP_RETRY") | 
					
						
							| 
									
										
										
										
											2021-01-21 12:34:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-05 15:43:55 +00:00
										 |  |  |   if defined?(Bootsnap) | 
					
						
							| 
									
										
										
										
											2022-05-30 04:37:09 +01:00
										 |  |  |     cache = ENV.fetch("HOMEBREW_CACHE", nil) || ENV.fetch("HOMEBREW_DEFAULT_CACHE", nil) | 
					
						
							| 
									
										
										
										
											2023-03-01 07:34:53 -08:00
										 |  |  |     raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty? | 
					
						
							| 
									
										
										
										
											2021-02-05 15:43:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-30 18:57:01 +00:00
										 |  |  |     # We never do `require "vendor/bundle/ruby/..."` or `require "vendor/portable-ruby/..."`, | 
					
						
							|  |  |  |     # so let's slim the cache a bit by excluding them. | 
					
						
							|  |  |  |     # Note that gems within `bundle/ruby` will still be cached - these are when directory walking down from above. | 
					
						
							|  |  |  |     ignore_directories = [ | 
					
						
							|  |  |  |       (HOMEBREW_LIBRARY_PATH/"vendor/bundle/ruby").to_s, | 
					
						
							|  |  |  |       (HOMEBREW_LIBRARY_PATH/"vendor/portable-ruby").to_s, | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-05 15:43:55 +00:00
										 |  |  |     Bootsnap.setup( | 
					
						
							|  |  |  |       cache_dir:          cache, | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |       ignore_directories:, | 
					
						
							| 
									
										
										
										
											2021-02-05 15:43:55 +00:00
										 |  |  |       load_path_cache:    true, | 
					
						
							|  |  |  |       compile_cache_iseq: true, | 
					
						
							|  |  |  |       compile_cache_yaml: true, | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |     $stderr.puts "Error: HOMEBREW_BOOTSNAP could not `require \"bootsnap\"`!\n\n" | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2021-02-02 11:50:44 +00:00
										 |  |  | end |