diff --git a/lib/rake/task_manager.rb b/lib/rake/task_manager.rb index 0db5c241e..74accd03b 100644 --- a/lib/rake/task_manager.rb +++ b/lib/rake/task_manager.rb @@ -302,6 +302,8 @@ def make_sources(task_name, task_pattern, extensions) source == ext ? task_name.ext(ext) : source when String, Symbol ext.to_s + when Pathname + Rake.from_pathname(ext) when Proc, Method if ext.arity == 1 ext.call(task_name) diff --git a/test/test_rake_rules.rb b/test/test_rake_rules.rb index e20df9350..48fab0bad 100644 --- a/test/test_rake_rules.rb +++ b/test/test_rake_rules.rb @@ -80,6 +80,16 @@ def test_rule_prereqs_can_be_created_by_string assert_equal [OBJFILE], @runs end + def test_rule_prereqs_can_be_created_by_pathname + create_file(SRCFILE) + create_file(FOOFILE) + rule ".o" => [".c", Pathname(FOOFILE)] do |t| + @runs << t.name + end + Task[OBJFILE].invoke + assert_equal [OBJFILE], @runs + end + def test_rule_prereqs_can_be_created_by_symbol task :nonfile do |t| @runs << t.name