gruntjs/grunt — pull request #1030 by itayadler (2014-01-17 23:14:37+00:00)
Title: Added to grunt the hideTask() method

The **hideTask** method allows the user to hide tasks he doesn't want to externalise to the user. The task could still be used by the user for queue'ing in other tasks.
When using the method on a registered task, the task becomes invisible to a user through `grunt -h` or `grunt --verbose --version`, and if for any
reason he wishes to execute it through the CLI, he'll get the same warning he would get for executing a task that doesn't exist.

I've added 3 new methods to Task, only hideTask is exposed:
**hideTask**: (name) - Allows the user to internalise a task, making it executable from inside grunt but not executable from the CLI.
- **name** - The name of the registered task.
**isTaskHidden**: (name) - Returns a boolean whether the registered task is hidden or not.
- **name** - The name of the registered task.
**availableTasks**: Returns an object without the tasks that are hidden.

I'm also using an internal variable `_hiddenTasks`, to keep track of which tasks were hidden.

___Things that aren't covered by the PR___
* I didn't write tests that ensure the task isn't displayed in `grunt -h` or `grunt --version --verbose`.
* I didn't write tests that ensure that a user can't execute a hidden task.

Since this PR is based on an issue (#910) that's not marked as **Needs PR**, I hope it will shed some more light into this issue, in hopes of getting something like this into grunt in the future.

As a side note I wish to use this feature in https://github.com/BlueHotDog/sails-migrations, where we used grunt to externalise db migration tasks, but we have internal tasks which we wish not to externalise to the user. Since grunt doesn't have a way to register a task with a dependency that is run before the task itself, we needed to create these internal tasks, that are later composed into the 'public' task. An example of this is that all tasks need the db:loadConfig task to run before each of 'em, so we've registered an 'internal task' for each of the actual tasks that does it's job, and then registered an external task that queues the db:loadConfig task & the internal task.