Permalink
Browse files

non-file tasks now always report current time as timestamp

  • Loading branch information...
1 parent bb41014 commit c0482b470fa004229a869f4e8e1f2723864f980b @jimweirich committed Oct 26, 2012
Showing with 14 additions and 4 deletions.
  1. +10 −0 doc/release_notes/rake-10.0.0.rdoc
  2. +1 −1 lib/rake/task.rb
  3. +2 −2 test/test_rake_file_task.rb
  4. +1 −1 test/test_rake_task.rb
View
10 doc/release_notes/rake-10.0.0.rdoc
@@ -66,6 +66,16 @@ there are a number of features missing:
* The deprecated <tt>rake/gempackagetask.rb</tt> library has been
removed. Gem supplies its own package task now.
+There is one small behavioral change:
+
+* Non-file tasks now always report the current time as their time
+ stamp. This is different from the previous behavior where non-file
+ tasks reported current time only if there were no prerequisites, and
+ the max prerequisite timestamp otherwise. This lead to inconsistent
+ and surprising behavior when adding prerequisites to tasks that in
+ turn were prequisites to file tasks. The new behavior is more
+ consistent and predictable.
+
== Changes (from 0.9.3)
Since Rake 10 includes the changes from the last version of Rake 9,
View
2 lib/rake/task.rb
@@ -237,7 +237,7 @@ def needed?
# Timestamp for this task. Basic tasks return the current time for their
# time stamp. Other tasks can be more sophisticated.
def timestamp
- prerequisite_tasks.collect { |pre| pre.timestamp }.max || Time.now
+ Time.now
end
# Add a description to the task. The description can consist of an option
View
4 test/test_rake_file_task.rb
@@ -59,7 +59,7 @@ def test_file_times_new_depend_on_regular_task_timestamps
task(name => :phony)
- assert ! t1.needed?, "unless the non-file task has a timestamp"
+ assert t1.needed?, "unless the non-file task has a timestamp"
end
def test_file_times_old_depends_on_new
@@ -83,7 +83,7 @@ def test_file_depends_on_task_depend_on_file
Task[:obj].invoke
Task[NEWFILE].invoke
- assert ! @runs.include?(NEWFILE)
+ assert @runs.include?(NEWFILE)
end
def test_existing_file_depends_on_non_existing_file
View
2 test/test_rake_task.rb
@@ -238,7 +238,7 @@ def test_timestamp_returns_latest_prereq_timestamp
def b.timestamp() Time.now + 10 end
def c.timestamp() Time.now + 5 end
- assert_in_delta now + 10, a.timestamp, 0.1, 'computer too slow?'
+ assert_in_delta now, a.timestamp, 0.1, 'computer too slow?'
end
def test_always_multitask

0 comments on commit c0482b4

Please sign in to comment.