| 
									
										
										
										
											2018-02-01 16:06:17 -05:00
										 |  |  | #:  * `--env` [`--shell=`(<shell>|`auto`)|`--plain`]: | 
					
						
							|  |  |  | #:    Show a summary of the Homebrew build environment as a plain list. | 
					
						
							|  |  |  | #: | 
					
						
							|  |  |  | #:    Pass `--shell=`<shell> to generate a list of environment variables for the | 
					
						
							|  |  |  | #:    specified shell, or `--shell=auto` to detect the current shell. | 
					
						
							|  |  |  | #: | 
					
						
							|  |  |  | #:    If the command's output is sent through a pipe and no shell is specified, | 
					
						
							|  |  |  | #:    the list is formatted for export to `bash`(1) unless `--plain` is passed. | 
					
						
							| 
									
										
										
										
											2016-04-17 09:16:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-19 17:57:36 -05:00
										 |  |  | require "extend/ENV" | 
					
						
							| 
									
										
										
										
											2015-11-13 16:43:43 +01:00
										 |  |  | require "build_environment" | 
					
						
							| 
									
										
										
										
											2016-08-10 23:19:09 -07:00
										 |  |  | require "utils/shell" | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   def __env | 
					
						
							| 
									
										
										
										
											2013-08-19 12:32:56 -05:00
										 |  |  |     ENV.activate_extensions! | 
					
						
							| 
									
										
										
										
											2015-06-17 22:03:50 -04:00
										 |  |  |     ENV.deps = ARGV.formulae if superenv? | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     ENV.setup_build_environment | 
					
						
							| 
									
										
										
										
											2011-12-31 21:22:22 -06:00
										 |  |  |     ENV.universal_binary if ARGV.build_universal? | 
					
						
							| 
									
										
										
										
											2014-09-14 01:26:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 23:19:09 -07:00
										 |  |  |     shell_value = ARGV.value("shell") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-22 18:02:39 -07:00
										 |  |  |     if ARGV.include?("--plain") | 
					
						
							| 
									
										
										
										
											2016-08-10 23:19:09 -07:00
										 |  |  |       shell = nil | 
					
						
							|  |  |  |     elsif shell_value.nil? | 
					
						
							|  |  |  |       # legacy behavior | 
					
						
							|  |  |  |       shell = :bash unless $stdout.tty? | 
					
						
							|  |  |  |     elsif shell_value == "auto" | 
					
						
							| 
									
										
										
										
											2017-04-22 16:28:07 +01:00
										 |  |  |       shell = Utils::Shell.parent || Utils::Shell.preferred | 
					
						
							| 
									
										
										
										
											2016-08-10 23:19:09 -07:00
										 |  |  |     elsif shell_value | 
					
						
							| 
									
										
										
										
											2017-04-22 16:28:07 +01:00
										 |  |  |       shell = Utils::Shell.from_path(shell_value) | 
					
						
							| 
									
										
										
										
											2016-08-10 23:19:09 -07:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     env_keys = build_env_keys(ENV) | 
					
						
							|  |  |  |     if shell.nil? | 
					
						
							| 
									
										
										
										
											2012-03-02 00:59:22 +00:00
										 |  |  |       dump_build_env ENV | 
					
						
							|  |  |  |     else | 
					
						
							| 
									
										
										
										
											2018-07-26 10:48:25 +01:00
										 |  |  |       env_keys.each do |key| | 
					
						
							|  |  |  |         puts Utils::Shell.export_value(key, ENV[key], shell) | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-03-02 00:59:22 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | end |