| 
									
										
										
										
											2024-09-04 02:35:40 +01:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-19 13:11:32 +00:00
										 |  |  | raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"] | 
					
						
							| 
									
										
										
										
											2019-01-12 15:59:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-21 10:11:58 +00:00
										 |  |  | # The path to the executable that should be used to run `brew`. | 
					
						
							|  |  |  | # This may be HOMEBREW_ORIGINAL_BREW_FILE or HOMEBREW_BREW_WRAPPER depending on | 
					
						
							|  |  |  | # the system configuration. Favour this instead of running `brew` and expecting | 
					
						
							|  |  |  | # it to be in the `PATH`. | 
					
						
							|  |  |  | # @api public | 
					
						
							| 
									
										
										
										
											2022-05-30 04:05:07 +01:00
										 |  |  | HOMEBREW_BREW_FILE = Pathname(ENV.fetch("HOMEBREW_BREW_FILE")).freeze | 
					
						
							| 
									
										
										
										
											2015-04-28 22:37:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-21 10:11:58 +00:00
										 |  |  | # Where Homebrew is installed and files are linked to. | 
					
						
							|  |  |  | # @api public | 
					
						
							| 
									
										
										
										
											2022-05-30 04:05:07 +01:00
										 |  |  | HOMEBREW_PREFIX = Pathname(ENV.fetch("HOMEBREW_PREFIX")).freeze | 
					
						
							| 
									
										
										
										
											2015-04-28 22:37:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-21 10:11:58 +00:00
										 |  |  | # Where Homebrew stores built formulae packages, linking (non-keg-only) ones | 
					
						
							|  |  |  | # back to `HOMEBREW_PREFIX`. | 
					
						
							|  |  |  | # @api public | 
					
						
							|  |  |  | HOMEBREW_CELLAR = Pathname(ENV.fetch("HOMEBREW_CELLAR")).freeze | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Where Homebrew downloads (bottles, source tarballs, casks etc.) are cached. | 
					
						
							|  |  |  | # @api public | 
					
						
							|  |  |  | HOMEBREW_CACHE = Pathname(ENV.fetch("HOMEBREW_CACHE")).freeze | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Where Homebrew stores temporary files. | 
					
						
							|  |  |  | # We use `/tmp` instead of `TMPDIR` because long paths break Unix domain | 
					
						
							|  |  |  | # sockets. | 
					
						
							|  |  |  | # @api public | 
					
						
							|  |  |  | HOMEBREW_TEMP = Pathname(ENV.fetch("HOMEBREW_TEMP")).then do |tmp| | 
					
						
							|  |  |  |   tmp.mkpath unless tmp.exist? | 
					
						
							|  |  |  |   tmp.realpath | 
					
						
							|  |  |  | end.freeze | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Path to `bin/brew` main executable in `HOMEBREW_PREFIX` | 
					
						
							|  |  |  | # Used for e.g. permissions checks. | 
					
						
							|  |  |  | HOMEBREW_ORIGINAL_BREW_FILE = Pathname(ENV.fetch("HOMEBREW_ORIGINAL_BREW_FILE")).freeze | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-18 21:42:43 -04:00
										 |  |  | # Where `.git` is found | 
					
						
							| 
									
										
										
										
											2022-05-30 04:05:07 +01:00
										 |  |  | HOMEBREW_REPOSITORY = Pathname(ENV.fetch("HOMEBREW_REPOSITORY")).freeze | 
					
						
							| 
									
										
										
										
											2015-04-28 22:37:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-30 11:10:23 +02:00
										 |  |  | # Where we store most of Homebrew, taps and various metadata | 
					
						
							| 
									
										
										
										
											2022-05-30 04:05:07 +01:00
										 |  |  | HOMEBREW_LIBRARY = Pathname(ENV.fetch("HOMEBREW_LIBRARY")).freeze | 
					
						
							| 
									
										
										
										
											2016-07-02 06:03:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-15 19:03:45 +01:00
										 |  |  | # Where shim scripts for various build and SCM tools are stored | 
					
						
							| 
									
										
										
										
											2019-04-19 21:46:20 +09:00
										 |  |  | HOMEBREW_SHIMS_PATH = (HOMEBREW_LIBRARY/"Homebrew/shims").freeze | 
					
						
							| 
									
										
										
										
											2015-04-28 22:37:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-18 10:56:54 -04:00
										 |  |  | # Where external data that has been incorporated into Homebrew is stored | 
					
						
							|  |  |  | HOMEBREW_DATA_PATH = (HOMEBREW_LIBRARY/"Homebrew/data").freeze | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-16 13:51:21 +01:00
										 |  |  | # Where we store symlinks to currently linked kegs | 
					
						
							| 
									
										
										
										
											2019-04-19 21:46:20 +09:00
										 |  |  | HOMEBREW_LINKED_KEGS = (HOMEBREW_PREFIX/"var/homebrew/linked").freeze | 
					
						
							| 
									
										
										
										
											2016-09-16 13:51:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-17 13:25:32 +01:00
										 |  |  | # Where we store symlinks to currently version-pinned kegs | 
					
						
							| 
									
										
										
										
											2019-04-19 21:46:20 +09:00
										 |  |  | HOMEBREW_PINNED_KEGS = (HOMEBREW_PREFIX/"var/homebrew/pinned").freeze | 
					
						
							| 
									
										
										
										
											2016-09-16 13:51:21 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-08 17:29:03 +08:00
										 |  |  | # Where we store lock files | 
					
						
							| 
									
										
										
										
											2019-04-19 21:46:20 +09:00
										 |  |  | HOMEBREW_LOCKS = (HOMEBREW_PREFIX/"var/homebrew/locks").freeze | 
					
						
							| 
									
										
										
										
											2016-06-08 17:29:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-17 11:59:40 +09:00
										 |  |  | # Where we store Casks | 
					
						
							|  |  |  | HOMEBREW_CASKROOM = Pathname(ENV.fetch("HOMEBREW_CASKROOM")).freeze | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-26 15:21:24 -05:00
										 |  |  | # Where formulae installed via URL are cached | 
					
						
							| 
									
										
										
										
											2019-04-19 21:46:20 +09:00
										 |  |  | HOMEBREW_CACHE_FORMULA = (HOMEBREW_CACHE/"Formula").freeze | 
					
						
							| 
									
										
										
										
											2016-05-03 16:01:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-30 11:10:23 +02:00
										 |  |  | # Where build, postinstall and test logs of formulae are written to | 
					
						
							| 
									
										
										
										
											2022-05-30 04:05:07 +01:00
										 |  |  | HOMEBREW_LOGS = Pathname(ENV.fetch("HOMEBREW_LOGS")).expand_path.freeze | 
					
						
							| 
									
										
										
										
											2015-04-28 22:37:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-10 17:38:27 -07:00
										 |  |  | # Where installed taps live | 
					
						
							|  |  |  | HOMEBREW_TAP_DIRECTORY = (HOMEBREW_LIBRARY/"Taps").freeze | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-25 16:29:05 +00:00
										 |  |  | # The Ruby path and args to use for forked Ruby calls | 
					
						
							|  |  |  | HOMEBREW_RUBY_EXEC_ARGS = [ | 
					
						
							|  |  |  |   RUBY_PATH, | 
					
						
							| 
									
										
										
										
											2022-05-30 04:37:09 +01:00
										 |  |  |   ENV.fetch("HOMEBREW_RUBY_WARNINGS"), | 
					
						
							| 
									
										
										
										
											2022-11-05 01:58:12 +00:00
										 |  |  |   ENV.fetch("HOMEBREW_RUBY_DISABLE_OPTIONS"), | 
					
						
							| 
									
										
										
										
											2021-02-25 16:29:05 +00:00
										 |  |  | ].freeze | 
					
						
							| 
									
										
										
										
											2025-02-07 14:31:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Location for `brew alias` and `brew unalias` commands. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Unix-Like systems store config in $HOME/.config whose location can be | 
					
						
							|  |  |  | # overridden by the XDG_CONFIG_HOME environment variable. Unfortunately | 
					
						
							|  |  |  | # Homebrew strictly filters environment variables in BuildEnvironment. | 
					
						
							|  |  |  | HOMEBREW_ALIASES = if (path = Pathname.new("~/.config/brew-aliases").expand_path).exist? || | 
					
						
							|  |  |  |                       (path = Pathname.new("~/.brew-aliases").expand_path).exist? | 
					
						
							|  |  |  |   path.realpath | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |   path | 
					
						
							|  |  |  | end.freeze |