From 760c083c0c0c9934e4118b4669c8c8dfd0a3587d Mon Sep 17 00:00:00 2001 From: Max Howell Date: Mon, 10 Aug 2009 16:48:30 +0100 Subject: Refactor 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. --- Library/Homebrew/utils.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/utils.rb') 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 -- cgit v1.2.3