Is it possible to get a list of already registered tasks inside of my Gruntfile.js, or alternatively check if a single taskname is registered.
What I'm trying to do is: Split the grunt module configurations into single files, to be able to add and remove them easily and finally only load the modules and their configuration if they're installed (based on package.json devDependencies with the help from 'matchdep'). This is working fine so far. Additionally I need to have the aliasTask's defined in a JSON (to be able to easily add new tasks programmatically).
The problem is, that the list may contain unregistered tasks and since grunt throws an error if that task is not registered, I have to filter them out from the list, before calling registerTask. Therefor I'm looking for a way to test the current taskName if an appropriate task is registered.
Here's a gist showing the idea https://gist.github.com/MarcelloDiSimone/5631466
In that gist I'm currently checking against the keys of the configuration files, but this is not reliable, since some tasks may not have a configuration (like livereload) and thus they would be falsely filtered out.