buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r616210 - in /incubator/buildr/trunk/lib/core: application.rb help.rb
Date Tue, 29 Jan 2008 08:46:22 GMT
Author: assaf
Date: Tue Jan 29 00:46:21 2008
New Revision: 616210

URL: http://svn.apache.org/viewvc?rev=616210&view=rev
Log:
Added timing and fixed help task

Modified:
    incubator/buildr/trunk/lib/core/application.rb
    incubator/buildr/trunk/lib/core/help.rb

Modified: incubator/buildr/trunk/lib/core/application.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/application.rb?rev=616210&r1=616209&r2=616210&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/application.rb (original)
+++ incubator/buildr/trunk/lib/core/application.rb Tue Jan 29 00:46:21 2008
@@ -1,3 +1,6 @@
+require 'benchmark'
+
+
 module Buildr
 
   # When running from +rake+, we already have an Application setup and must plug into it,
@@ -42,12 +45,20 @@
         collect_tasks
         top_level_tasks.unshift 'buildr:initialize'
       end
-
       def run()
-        standard_exception_handling do
-          find_buildfile
-          load_buildfile
-          top_level
+        times = Benchmark.measure do
+          standard_exception_handling do
+            find_buildfile
+            load_buildfile
+            top_level
+          end
+        end
+        if verbose
+          real = []
+          real << ("%ih" % (times.real / 3600)) if times.real >= 3600
+          real << ("%im" % ((times.real / 60) % 60)) if times.real >= 60
+          real << ("%.3fs" % (times.real % 60))
+          puts "Completed in #{real.join} seconds"
         end
       end
 

Modified: incubator/buildr/trunk/lib/core/help.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/help.rb?rev=616210&r1=616209&r2=616210&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/help.rb (original)
+++ incubator/buildr/trunk/lib/core/help.rb Tue Jan 29 00:46:21 2008
@@ -47,7 +47,7 @@
       puts 'Top-level projects (buildr help:projects for full list):'
       width = [top_level.map(&:name).map(&:size), 20].flatten.max
       top_level.each do |project|
-        puts project.comment.blank? ? project.name : ("  %-#{width}s  # %s" % [project.name,
project.comment])
+        puts project.comment.to_s.blank? ? project.name : ("  %-#{width}s  # %s" % [project.name,
project.comment])
       end
       puts
     end



Mime
View raw message