You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/08/27 02:49:35 UTC
svn commit: r689308 - /incubator/buildr/trunk/lib/buildr/core/test.rb
Author: assaf
Date: Tue Aug 26 17:49:35 2008
New Revision: 689308
URL: http://svn.apache.org/viewvc?rev=689308&view=rev
Log:
Even better than inject, [].max.
Modified:
incubator/buildr/trunk/lib/buildr/core/test.rb
Modified: incubator/buildr/trunk/lib/buildr/core/test.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/test.rb?rev=689308&r1=689307&r2=689308&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/test.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/test.rb Tue Aug 26 17:49:35 2008
@@ -471,8 +471,7 @@
end
def needed? #:nodoc:
- latest_prerequisite = @prerequisites.map { |p| application[p, @scope] }.
- inject { |latest, task| task.timestamp > latest.timestamp ? task :latest }
+ latest_prerequisite = @prerequisites.map { |p| application[p, @scope] }.max { |a,b| a.timestamp<=>b.timestamp }
needed = (timestamp == Rake::EARLY) || latest_prerequisite.timestamp > timestamp
trace "Testing#{needed ? ' ' : ' not '}needed. " +
"Latest prerequisite change: #{latest_prerequisite.timestamp} (#{latest_prerequisite.to_s}). " +