TaskManager#synthesize_file_task results in surprising command line behavior
I have a Rakefile with the report task defined. There are no FileTasks in my Rakefile. I also have a reports dir at my project toplevel.
If I run rake report then my task is executed as expected. If I run rake reportx then I get the expected error about "don't know how to build task". If I run rake reports then I get a NOOP. No errors.
I don't understand why, for any existing file or dir passed to rake as a target, rake will create a NOOP FileTask. What is gained from having tons of (potential) NOOP tasks that correspond to every single file and dir (and possible path to such) on the filesystem?
In my rake reports case, I would much prefer an error. So the downside is that the user doesn't get an error for erroneous tasks that were never defined. What is the upside of TaskManager#synthesize_file_task ?
I believe its invocation here is causing the problem (lacking an error) for my rake reports case.
This appears to be a (more informative) dupe of #127 If one issue must prevail, I suggest this one :)
Recently encountered this issue as well due to some unexpected pattern matching from the shell. I have a release task defined and a releases directory. When executing the release task with an argument like rake release[test] Rake runs the NOP releases task because the shell pattern matched the directory and replaced release[test] with releases. Very annoying and very confusing, but not really Rake's fault.
I don't understand why, for any existing file or dir passed to rake as a target, rake will create a NOOP FileTask. What is gained from having tons of (potential) NOOP tasks that correspond to every single file and dir (and possible path to such) on the filesystem?
My naive understanding of this behavior is that it appears to be a side effect of how Rake handles dependencies. If a task or rule depends on a file, Rake will automatically create a NOP task for it if the file exists. The task can then be added to part of the dependency chain.
This is entirely consistent with rake's ancestry being a ruby version of make. The original purpose of make (and thus rake) is to make files. What we call tasks are an extension of the underlying recipes for making files (typically by compiling from source files).
Just like make, if a file exists, then its task is considered satisfied (modulo, the file's mtime). Thus the noop task is necessary to allow any tasks or dependencies to depend on files.