expose functions and add tests

I reorganized the code, please have a look if you are ok with this. 

The new tests check if the correct argument array for `grunt.util.spawn` is being constructed.