mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Fixes to merge conflicts, updating to master
This commit is contained in:
@@ -7,11 +7,15 @@
|
||||
// ==========================================
|
||||
|
||||
var request = require('request');
|
||||
var _ = require('underscore');
|
||||
var config = require('./config');
|
||||
|
||||
var endpoint = config.endpoint + '/packages';
|
||||
|
||||
if (process.env.HTTP_PROXY) {
|
||||
request = request.defaults({'proxy': process.env.HTTP_PROXY});
|
||||
}
|
||||
|
||||
|
||||
// allow for searchpath endpoints to be used for search and lookup
|
||||
var endpoints = [];
|
||||
endpoints.push(endpoint);
|
||||
@@ -21,9 +25,9 @@ if (config.searchpath) {
|
||||
}
|
||||
}
|
||||
|
||||
// walk all search path endpoints to find the component
|
||||
exports.lookup = function (name, callback) {
|
||||
|
||||
// walk all endpoints to find the first matching component
|
||||
var f = function(i) {
|
||||
var endpoint = endpoints[i];
|
||||
request.get(endpoint + '/' + encodeURIComponent(name), function (err, response, body) {
|
||||
@@ -47,12 +51,11 @@ exports.lookup = function (name, callback) {
|
||||
f(0);
|
||||
};
|
||||
|
||||
|
||||
exports.register = function (name, url, callback) {
|
||||
|
||||
var body = {name: name, url: url};
|
||||
|
||||
request.post({url: endpoint, form: body}, function (err, response, body) {
|
||||
request.post({url: endpoint, form: body}, function (err, response) {
|
||||
if (err) return callback(err);
|
||||
|
||||
if (response.statusCode === 406) {
|
||||
@@ -71,11 +74,9 @@ exports.register = function (name, url, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
// walks all searchpath endpoints and produces federated search results
|
||||
exports.search = function (name, callback) {
|
||||
|
||||
// walk all endpoints to produced federated search results
|
||||
var f = function(i, map, results) {
|
||||
var endpoint = endpoints[i];
|
||||
request.get(endpoint + '/search/' + encodeURIComponent(name), function (err, response, body) {
|
||||
@@ -106,8 +107,6 @@ exports.search = function (name, callback) {
|
||||
f(0, {}, []);
|
||||
};
|
||||
|
||||
|
||||
|
||||
exports.info = function (name, callback) {
|
||||
exports.lookup(name, function (err, url) {
|
||||
if (err) return callback(err);
|
||||
@@ -123,11 +122,9 @@ exports.info = function (name, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
// walks all searchpath endpoints and produces federated results
|
||||
exports.all = function (callback) {
|
||||
|
||||
|
||||
// walk all endpoints to produced federated search results
|
||||
var f = function(i, results) {
|
||||
var endpoint = endpoints[i];
|
||||
request.get(endpoint, function (err, response, body) {
|
||||
|
||||
Reference in New Issue
Block a user