Merge pull request #40 from arturopie/master

added running time
This commit is contained in:
Nick Gauthier 2011-05-20 06:42:08 -07:00
commit 88c07f864f
1 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,9 @@ module Hydra #:nodoc:
attr_accessor :environment attr_accessor :environment
# Set to false if you don't want to show the total running time
attr_accessor :show_time
# #
# Search for the hydra config file # Search for the hydra config file
def find_config_file def find_config_file
@ -77,6 +80,7 @@ module Hydra #:nodoc:
@autosort = true @autosort = true
@serial = false @serial = false
@listeners = [Hydra::Listener::ProgressBar.new] @listeners = [Hydra::Listener::ProgressBar.new]
@show_time = true
yield self if block_given? yield self if block_given?
@ -114,7 +118,12 @@ module Hydra #:nodoc:
$stderr.puts %{WARNING: Rails Environment is "development". Make sure to set it properly (ex: "RAILS_ENV=test rake hydra")} $stderr.puts %{WARNING: Rails Environment is "development". Make sure to set it properly (ex: "RAILS_ENV=test rake hydra")}
end end
start = Time.now if @show_time
master = Hydra::Master.new(@opts) master = Hydra::Master.new(@opts)
$stdout.puts "\nFinished in #{'%.6f' % (Time.now - start)} seconds." if @show_time
unless master.failed_files.empty? unless master.failed_files.empty?
raise "Hydra: Not all tests passes" raise "Hydra: Not all tests passes"
end end