Skip to content

Commit

Permalink
dry-run also smart about 2-level nesting of potential file task execu…
Browse files Browse the repository at this point in the history
…tions. Fixes ruby#92
  • Loading branch information
grzuy committed Feb 7, 2018
1 parent b155dba commit 1247873
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rake/file_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def potentially_needed?
(
application.options.dryrun &&
prerequisite_tasks.any? do |prerequisite_task|
prerequisite_task.is_a?(Rake::FileTask) && prerequisite_task.needed?
prerequisite_task.is_a?(Rake::FileTask) && prerequisite_task.potentially_needed?
end
)
end
Expand Down
5 changes: 4 additions & 1 deletion test/test_rake_functional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,23 @@ def test_update_midway_through_chaining_to_file_task
FileUtils.touch("fileA")
FileUtils.touch("fileB")
FileUtils.touch("fileC")
FileUtils.touch("fileD")

rakefile <<-RAKEFILE
file "fileA" do; end
file "fileB" => ['fileA'] do; end
file "fileC" => ['fileB'] do; end
file "fileD" => ['fileC'] do; end
RAKEFILE

sleep 1
FileUtils.touch("fileA")

rake "-n", "fileC"
rake "-n", "fileD"

assert_match(/Execute \(dry run\) fileB/, @err)
assert_match(/May execute \(dry run\) fileC/, @err)
assert_match(/May execute \(dry run\) fileD/, @err)
end

# Test for the trace/dry_run bug found by Brian Chandler
Expand Down

0 comments on commit 1247873

Please sign in to comment.