gruntjs/grunt — pull request #854 by qraynaud (2013-07-28 12:32:05+00:00)
Title: Load NPM tasks using require

The basic idea behind this patch is to allow the full use of Npm as expected from the user. Loading Npm tasks should permit to load tasks from parent node_module folders.

The problem was that modules were not designed at all to permit this. Thus, modifying the load mechanism would break every one of them. This is baaad.

I worked out a way to use a brand new loading mechanism based on a require approach but to still retain the old approach during some time to allow packages to migrate to the new way.

To make a module compliant with the new load, you can just add in your main package script something like that:
```js
module.exports.registerNpmTasks = function(grunt) {
grunt.loadTasks(__dirname + '/tasks');
}
```
and that's all the work required.

When a package does not export this function, the old loading mechanism is tried. If it succeeds, a warning is issued to let people know this package requires an update.

To prevent code duplication I had to move away code and create some more functions. If you don't like anything in this patch, I would be happy to make any changes you deem required.