src/hooks/HooksRunner.js
function runScript(script, context) {
    if (typeof script.useModuleLoader == 'undefined') {
        // if it is not explicitly defined whether we should use modeule loader or not
        // we assume we should use module loader for .js files
        script.useModuleLoader = path.extname(script.path).toLowerCase() == '.js';
    }

    var source;
    var relativePath;

    if (script.plugin) {
        source = 'plugin ' + script.plugin.id;
        relativePath = path.join('plugins', script.plugin.id, script.path);
    } else if (script.useModuleLoader) {
        source = 'config.xml';
        relativePath = path.normalize(script.path);
    } else {
        source = 'hooks directory';
        relativePath = path.join('hooks', context.hook, script.path);
    }

    events.emit('verbose', 'Executing script found in ' + source + ' for hook "' + context.hook + '": ' + relativePath);

    if(script.useModuleLoader) {
        return runScriptViaModuleLoader(script, context);
    } else {
        return runScriptViaChildProcessSpawn(script, context);
    }
}
function runScript(script, context) {
    if (typeof script.useModuleLoader == 'undefined') {
        // if it is not explicitly defined whether we should use modeule loader or not
        // we assume we should use module loader for .js files
        script.useModuleLoader = path.extname(script.path).toLowerCase() == '.js';
    }

    var source;
    var relativePath;

    if (script.plugin) {
        source = 'plugin ' + script.plugin.id;
        relativePath = path.join('plugins', script.plugin.id, script.path);
    } else if (script.useModuleLoader) {
        source = 'config.xml';
        relativePath = path.normalize(script.path);
    } else {
        source = 'hooks directory';
        relativePath = path.join('hooks', context.hook, script.path);
    }

    events.emit('verbose', 'Executing script found in ' + source + ' for hook "' + context.hook + '": ' + relativePath);

    if(script.useModuleLoader) {
        return runScriptViaModuleLoader(script, context);
    } else {
        return runScriptViaChildProcessSpawn(script, context);
    }
}
function runScript ( script , context ) { if ( typeof script . useModuleLoader == 'undefined' ) { // if it is not explicitly defined whether we should use modeule loader or not // we assume we should use module loader for .js files script . useModuleLoader = path . extname ( script . path ) . toLowerCase ( ) == '.js' ; } var source ; var relativePath ; if ( script . plugin ) { source = 'plugin ' + script . plugin . id ; relativePath = path . join ( 'plugins' , script . plugin . id , script . path ) ; } else if ( script . useModuleLoader ) { source = 'config.xml' ; relativePath = path . normalize ( script . path ) ; } else { source = 'hooks directory' ; relativePath = path . join ( 'hooks' , context . hook , script . path ) ; } events . emit ( 'verbose' , 'Executing script found in ' + source + ' for hook "' + context . hook + '": ' + relativePath ) ; if ( script . useModuleLoader ) { return runScriptViaModuleLoader ( script , context ) ; } else { return runScriptViaChildProcessSpawn ( script , context ) ; } }
Async runs single script file.
Async runs single script file .