aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-06-15 01:41:53 +0100
committerMax Howell2009-06-15 01:41:53 +0100
commitebd9d173d42836c8e207504b9f9a18be0f6878f5 (patch)
treee01314d37da28709bbacc423ab2a15a0b142f5d3
parent02e53d44cb23e5f798897ac97df357353c0e6242 (diff)
downloadbrew-ebd9d173d42836c8e207504b9f9a18be0f6878f5.tar.bz2
pretty_duration function
-rwxr-xr-xbin/brew9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/brew b/bin/brew
index bbdb48bb6..3f4368163 100755
--- a/bin/brew
+++ b/bin/brew
@@ -182,6 +182,13 @@ def abv keg=''
`find #{keg} -type f | wc -l`.strip+' files, '+`du -hd0 #{keg} | cut -d"\t" -f1`.strip
end
+######################################################################## utils
+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
+
######################################################################### impl
begin
case ARGV.shift
@@ -228,7 +235,7 @@ begin
puts o.caveats
ohai "Summary"
end
- puts "#{o.prefix}: "+abv(name)+", built in #{Time.now - beginning} seconds"
+ puts "#{o.prefix}: "+abv(name)+", built in #{pretty_duration Time.now-beginning}"
rescue Exception
FileUtils.rm_rf o.prefix
raise