aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2014-01-04 12:49:01 +0000
committerMike McQuaid2014-01-04 13:19:20 +0000
commitf12d181433432fbc36bbdd0da1364dee7f18aa3f (patch)
treeea32424d6847c68d8cf7d1546e5cbe1d30adb8ff /Library
parent49f20ff9b09f6dab0f242ed90e69ac1dc3630bce (diff)
downloadhomebrew-f12d181433432fbc36bbdd0da1364dee7f18aa3f.tar.bz2
ENV: add method to prepend and create a PATH.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index fd4b78e13..f26fdb4ab 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -57,6 +57,12 @@ module SharedEnvExtension
prepend key, path, File::PATH_SEPARATOR if File.directory? path
end
+ def prepend_create_path key, path
+ path = Pathname.new(path) unless path.is_a? Pathname
+ path.mkpath
+ prepend_path key, path
+ end
+
def remove keys, value
Array(keys).each do |key|
next unless self[key]