tasks/lib/exec.js
function(grunt) {
        var i, binPath, paths;
        var nodePath = process.env.NODE_PATH || '';

        //check first the base path into the cwd
        paths = [
            __dirname + '/../../node_modules/.bin/jsdoc',
            __dirname + '/../../node_modules/jsdoc/jsdoc.js',
            __dirname + '/../../../jsdoc/jsdoc.js'
        ];

        //fall back on global if not found at the usual location
        nodePath.split(path.delimiter).forEach(function(p) {
            if (!/\/$/.test(p)) {
                p += '/';
            }
            paths.push(p + '/jsdoc/jsdoc.js');
        });

        for (i in paths) {
            binPath = path.resolve(paths[i]);
            if (grunt.file.exists(binPath) && grunt.file.isFile(binPath)) {
                return binPath;
            }
        }

        return;
    }
function(grunt) {
        var i, binPath, paths;
        var nodePath = process.env.NODE_PATH || '';

        //check first the base path into the cwd
        paths = [
            __dirname + '/../../node_modules/.bin/jsdoc',
            __dirname + '/../../node_modules/jsdoc/jsdoc.js',
            __dirname + '/../../../jsdoc/jsdoc.js'
        ];

        //fall back on global if not found at the usual location
        nodePath.split(path.delimiter).forEach(function(p) {
            if (!/\/$/.test(p)) {
                p += '/';
            }
            paths.push(p + '/jsdoc/jsdoc.js');
        });

        for (i in paths) {
            binPath = path.resolve(paths[i]);
            if (grunt.file.exists(binPath) && grunt.file.isFile(binPath)) {
                return binPath;
            }
        }

        return;
    }
function ( grunt ) { var i , binPath , paths ; var nodePath = process . env . NODE_PATH || '' ; //check first the base path into the cwd paths = [ __dirname + '/../../node_modules/.bin/jsdoc' , __dirname + '/../../node_modules/jsdoc/jsdoc.js' , __dirname + '/../../../jsdoc/jsdoc.js' ] ; //fall back on global if not found at the usual location nodePath . split ( path . delimiter ) . forEach ( function ( p ) { if ( ! / \/$ / . test ( p ) ) { p += '/' ; } paths . push ( p + '/jsdoc/jsdoc.js' ) ; } ) ; for ( i in paths ) { binPath = path . resolve ( paths [ i ] ) ; if ( grunt . file . exists ( binPath ) && grunt . file . isFile ( binPath ) ) { return binPath ; } } return ; }
Lookup file or path into node modules
@param {Object} grunt - the grunt context
@returns {String} the first matching resolved path or nothing if not found
Lookup file or path into node modules