aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorMax Howell2009-08-10 16:48:30 +0100
committerMax Howell2009-08-10 18:11:17 +0100
commit760c083c0c0c9934e4118b4669c8c8dfd0a3587d (patch)
tree0ed76c2d20225ff1fe7e07490bc17a8932d60bab /Library/Homebrew/utils.rb
parent5a396fd8b48835e826fe3193bd88e2274be60206 (diff)
downloadbrew-0.4.tar.bz2
Refactor0.4
Large refactor to Formula, mostly improving reliability and error handling but also layout and readability. General improvements so testing can be more complete. Patches are automatically downloaded and applied for Formula that return a list of urls from Formula::patches. Split out the brew command logic to facilitate testing. Facility from Adam Vandenberg to allow selective cleaning of files, added because Python doesn't work when stripped.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 112c6b6b6..bb64c3851 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -22,5 +22,24 @@ end
# shows a warning in delicious pink
def opoo warning
- puts "WARNING \033[1;35m#{warning}\033[0;0m"
+ puts "\033[1;35m==>\033[0;0;1m Warning\033[0;0m: #{warning}"
+end
+
+def onoe error
+ puts "\033[1;31m==>\033[0;0;1m Error\033[0;0m: #{error}"
+end
+
+def pretty_duration s
+ return "#{(s*1000).to_i} milliseconds" if s < 3
+ return "#{s.to_i} seconds" if s < 10*60
+ return "#{(s/60).to_i} minutes"
+end
+
+def interactive_shell
+ pid=fork
+ if pid.nil?
+ exec ENV['SHELL']
+ else
+ Process.wait pid
+ end
end