function resolveVersion(plugin) {
    var npnName = npmId(plugin);

    return initNPM()
    .then(function() {
        return Promise.nfcall(npm.commands.view, [npnName+'@*', 'engines'], true);
    })
    .then(function(versions) {
        return _.chain(versions)
            .pairs()
            .map(function(v) {
                return {
                    version: v[0],
                    gitbook: (v[1].engines || {}).gitbook
                };
            })
            .filter(function(v) {
                return v.gitbook && gitbook.satisfies(v.gitbook);
            })
            .sort(function(v1, v2) {
                return semver.lt(v1.version, v2.version)? 1 : -1;
            })
            .pluck('version')
            .first()
            .value();
    });
}
// Resolve the latest version for a plugin
Resolve the latest version for a plugin
Resolve the latest version for a plugin
function resolveVersion(plugin) {
    var npnName = npmId(plugin);
    return initNPM()
    .then(function() {
        return Promise.nfcall(npm.commands.view, [npnName+'@*', 'engines'], true);
    })
    .then(function(versions) {
        return _.chain(versions)
            .pairs()
            .map(function(v) {
                return {
                    version: v[0],
                    gitbook: (v[1].engines || {}).gitbook
                };
            })
            .filter(function(v) {
                return v.gitbook && gitbook.satisfies(v.gitbook);
            })
            .sort(function(v1, v2) {
                return semver.lt(v1.version, v2.version)? 1 : -1;
            })
            .pluck('version')
            .first()
            .value();
    });
}
function resolveVersion ( plugin ) { var npnName = npmId ( plugin ) ; return initNPM ( ) . then ( function ( ) { return Promise . nfcall ( npm . commands . view , [ npnName + '@*' , 'engines' ] , true ) ; } ) . then ( function ( versions ) { return _ . chain ( versions ) . pairs ( ) . map ( function ( v ) { return { version : v [ 0 ] , gitbook : ( v [ 1 ] . engines || { } ) . gitbook } ; } ) . filter ( function ( v ) { return v . gitbook && gitbook . satisfies ( v . gitbook ) ; } ) . sort ( function ( v1 , v2 ) { return semver . lt ( v1 . version , v2 . version ) ? 1 : - 1 ; } ) . pluck ( 'version' ) . first ( ) . value ( ) ; } ) ; }
Resolve the latest version for a plugin
Resolve the latest version for a plugin