function installPlugin(book, plugin, version) {
    book.log.info.ln('installing plugin', plugin);

    var npnName = npmId(plugin);

    return Promise()
    .then(function() {
        if (version) return version;

        book.log.info.ln('No version specified, resolve plugin "' + plugin + '"');
        return resolveVersion(plugin);
    })

    // Install the plugin with the resolved version
    .then(function(version) {
        if (!version) {
            throw new Error('Found no satisfactory version for plugin "' + plugin + '"');
        }

        book.log.info.ln('install plugin "' + plugin +'" from npm ('+npnName+') with version', version);
        return Promise.nfcall(npmi, {
            'name': npnName,
            'version': version,
            'path': book.root,
            'npmLoad': {
                'loglevel': 'silent',
                'loaded': true,
                'prefix': book.root
            }
        });
    })
    .then(function() {
        book.log.info.ok('plugin "' + plugin + '" installed with success');
    });
}
// Install a plugin in a book
Install a plugin in a book
Install a plugin in a book
function installPlugin(book, plugin, version) {
    book.log.info.ln('installing plugin', plugin);
    var npnName = npmId(plugin);
    return Promise()
    .then(function() {
        if (version) return version;
        book.log.info.ln('No version specified, resolve plugin "' + plugin + '"');
        return resolveVersion(plugin);
    })
    .then(function(version) {
        if (!version) {
            throw new Error('Found no satisfactory version for plugin "' + plugin + '"');
        }
        book.log.info.ln('install plugin "' + plugin +'" from npm ('+npnName+') with version', version);
        return Promise.nfcall(npmi, {
            'name': npnName,
            'version': version,
            'path': book.root,
            'npmLoad': {
                'loglevel': 'silent',
                'loaded': true,
                'prefix': book.root
            }
        });
    })
    .then(function() {
        book.log.info.ok('plugin "' + plugin + '" installed with success');
    });
}
function installPlugin ( book , plugin , version ) { book . log . info . ln ( 'installing plugin' , plugin ) ; var npnName = npmId ( plugin ) ; return Promise ( ) . then ( function ( ) { if ( version ) return version ; book . log . info . ln ( 'No version specified, resolve plugin "' + plugin + '"' ) ; return resolveVersion ( plugin ) ; } ) . then ( function ( version ) { if ( ! version ) { throw new Error ( 'Found no satisfactory version for plugin "' + plugin + '"' ) ; } book . log . info . ln ( 'install plugin "' + plugin + '" from npm (' + npnName + ') with version' , version ) ; return Promise . nfcall ( npmi , { 'name' : npnName , 'version' : version , 'path' : book . root , 'npmLoad' : { 'loglevel' : 'silent' , 'loaded' : true , 'prefix' : book . root } } ) ; } ) . then ( function ( ) { book . log . info . ok ( 'plugin "' + plugin + '" installed with success' ) ; } ) ; }
Install a plugin in a book
Install a plugin in a book
// Install the plugin with the resolved version