mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Fix update command not updating only desired packages.
Now throws an error if passing an unknown package.
This commit is contained in:
@@ -29,18 +29,34 @@ module.exports = function (names, options) {
|
||||
});
|
||||
|
||||
manager.on('data', emitter.emit.bind(emitter, 'data'));
|
||||
manager.on('warn', emitter.emit.bind(emitter, 'warn'));
|
||||
manager.on('error', emitter.emit.bind(emitter, 'error'));
|
||||
|
||||
var installURLS = function (err, arr) {
|
||||
var install = function (err, array) {
|
||||
var mappings = {},
|
||||
endpoints = [];
|
||||
endpoints = [],
|
||||
name,
|
||||
info,
|
||||
length,
|
||||
x;
|
||||
|
||||
arr = _.compact(arr);
|
||||
_.each(arr, function (info) {
|
||||
endpoints.push(info.endpoint);
|
||||
mappings[info.endpoint] = info.name;
|
||||
});
|
||||
length = names.length;
|
||||
if (length) {
|
||||
for (x = 0; x < length; x += 1) {
|
||||
name = names[x];
|
||||
info = _.find(array, function (info) { return info.name === name; });
|
||||
if (!info) {
|
||||
return emitter.emit('error', new Error('Package ' + name + ' is not installed'));
|
||||
}
|
||||
|
||||
endpoints.push(info.endpoint);
|
||||
mappings[info.endpoint] = info.name;
|
||||
}
|
||||
} else {
|
||||
array.forEach(function (info) {
|
||||
endpoints.push(info.endpoint);
|
||||
mappings[info.endpoint] = info.name;
|
||||
});
|
||||
}
|
||||
|
||||
options.endpointNames = mappings;
|
||||
|
||||
@@ -48,7 +64,6 @@ module.exports = function (names, options) {
|
||||
// But this leads to problems when the package name does not match the one in the url
|
||||
// So the manager now has an option (endpointNames) to deal with this
|
||||
manager = new Manager(endpoints, options);
|
||||
|
||||
manager
|
||||
.on('data', emitter.emit.bind(emitter, 'data'))
|
||||
.on('warn', emitter.emit.bind(emitter, 'warn'))
|
||||
@@ -62,8 +77,6 @@ module.exports = function (names, options) {
|
||||
};
|
||||
|
||||
manager.once('resolveLocal', function () {
|
||||
names = names.length ? _.uniq(names) : null;
|
||||
|
||||
async.map(_.values(manager.dependencies), function (pkgs, next) {
|
||||
var pkg = pkgs[0];
|
||||
pkg.once('loadJSON', function () {
|
||||
@@ -79,7 +92,7 @@ module.exports = function (names, options) {
|
||||
|
||||
next(null, { name: pkg.name, endpoint: endpoint });
|
||||
}).loadJSON();
|
||||
}, installURLS);
|
||||
}, install);
|
||||
}).resolveLocal();
|
||||
|
||||
return emitter;
|
||||
|
||||
Reference in New Issue
Block a user