Sha256: 34693833cd2d6e7e0f1ab36577b731c3f489fe5a52be683071ae40a43240836e

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

var Q = require('q');
var RegistryClient = require('bower-registry-client');
var cli = require('../util/cli');
var defaultConfig = require('../config');

function lookup(logger, name, config) {
    var registryClient;

    config = defaultConfig(config);
    config.cache = config.storage.registry;

    registryClient = new RegistryClient(config, logger);

    return Q.nfcall(registryClient.lookup.bind(registryClient), name)
    .then(function (entry) {
        // TODO: Handle entry.type.. for now it's only 'alias'
        //       When we got published packages, this needs to be adjusted
        return !entry ? null : {
            name: name,
            url: entry && entry.url
        };
    });
}

// -------------------

lookup.line = function (logger, argv) {
    var options =  cli.readOptions(argv);
    var name = options.argv.remain[1];

    if (!name) {
        return new Q();
    } else {
        return lookup(logger, name);
    }
};

lookup.completion = function () {
    // TODO:
};

module.exports = lookup;

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
entangled-0.0.16 spec/dummy/public/node_modules/bower/lib/commands/lookup.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/lib/commands/lookup.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/lib/commands/lookup.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/lib/commands/lookup.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/lib/commands/lookup.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/lib/commands/lookup.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/lib/commands/lookup.js