aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-08-29 11:21:15 -0400
committerMax Howell2012-08-29 12:41:38 -0400
commit15efd32835027e41a9d6514462df54b602663684 (patch)
tree301d03f864d951616de8b8ae74299b4820f79ce0 /Library
parent3a35b5208e5996792175792c35b59dcad9826ced (diff)
downloadhomebrew-15efd32835027e41a9d6514462df54b602663684.tar.bz2
`brew sh`: a shell with superenv loaded
If you need to build software on OS X by hand, a brew shell is the way to do it. Closes #14381.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/sh.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb
new file mode 100644
index 000000000..e62ef90c9
--- /dev/null
+++ b/Library/Homebrew/cmd/sh.rb
@@ -0,0 +1,22 @@
+require 'superenv'
+require 'formula'
+
+module Homebrew extend self
+ def sh
+ if superenv?
+ ENV.x11 = true
+ ENV.deps = Formula.installed.select{|f| f.keg_only? and f.opt_prefix.directory? }.map(&:name)
+ end
+ ENV.setup_build_environment
+ ENV['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
+ puts <<-EOS.undent_________________________________________________________72
+ Your shell has been configured to use Homebrew's build environment: this
+ should help you build stuff. Notably though, the system versions of gem
+ and pip will ignore our configuration and insist on using the
+ environment they were built under (mostly). Sadly, scons will also
+ ignore our configuration.
+ When done, type `exit'.
+ EOS
+ exec ENV['SHELL']
+ end
+end