mirror of
https://github.com/bower/bower.git
synced 2026-02-11 22:44:58 -05:00
Initial take on the commands + renderers + cli.
This commit is contained in:
@@ -100,8 +100,10 @@ Manager.prototype.install = function () {
|
||||
var release = decEndpoint.pkgMeta._release;
|
||||
|
||||
deferred.notify({
|
||||
type: 'action',
|
||||
data: 'Installing' + (release ? ' "' + release + '"' : ''),
|
||||
level: 'action',
|
||||
tag: 'install',
|
||||
data: name + (release ? '#' + release : ''),
|
||||
pkgMeta: decEndpoint.pkgMeta,
|
||||
origin: name,
|
||||
endpoint: decEndpoint
|
||||
});
|
||||
@@ -181,6 +183,8 @@ Manager.prototype.areCompatible = function (first, second) {
|
||||
|
||||
Manager.prototype._fetch = function (decEndpoint) {
|
||||
var name = decEndpoint.name;
|
||||
var deferred = this._deferred;
|
||||
var that = this;
|
||||
|
||||
// Mark as being fetched
|
||||
this._fetching[name] = this._fetching[name] || [];
|
||||
@@ -192,24 +196,36 @@ Manager.prototype._fetch = function (decEndpoint) {
|
||||
// because it might be reused if a similar endpoint needs to be resolved
|
||||
decEndpoint.promise = this._repository.fetch(decEndpoint)
|
||||
// When done, call onFetch
|
||||
.spread(this._onFetch.bind(this, decEndpoint))
|
||||
.spread(this._onFetch.bind(this, deferred, decEndpoint))
|
||||
// If it fails, we make the whole process to error out
|
||||
.fail(function (err) {
|
||||
err.origin = that._getOrigin(decEndpoint);
|
||||
err.endpoint = decEndpoint;
|
||||
deferred.reject(err);
|
||||
})
|
||||
// Listen to progress to proxy them to the resolve deferred
|
||||
// Note that we also mark where the notification is coming from
|
||||
.progress(function (notification) {
|
||||
notification.origin = that._getOrigin(decEndpoint);
|
||||
notification.endpoint = decEndpoint;
|
||||
notification.origin = name || decEndpoint.registryName || decEndpoint.resolverName;
|
||||
this._deferred.notify(notification);
|
||||
}.bind(this));
|
||||
deferred.notify(notification);
|
||||
});
|
||||
|
||||
return decEndpoint.promise;
|
||||
};
|
||||
|
||||
Manager.prototype._onFetch = function (decEndpoint, canonicalPkg, pkgMeta) {
|
||||
Manager.prototype._onFetch = function (deferred, decEndpoint, canonicalPkg, pkgMeta) {
|
||||
var name;
|
||||
var resolved;
|
||||
var index;
|
||||
var initialName = decEndpoint.name;
|
||||
|
||||
// If the deferred associated with the process is already rejected,
|
||||
// do not proceed.
|
||||
if (deferred.promise.isRejected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove from being fetched list
|
||||
mout.array.remove(this._fetching[initialName], decEndpoint);
|
||||
this._nrFetching--;
|
||||
@@ -373,6 +389,10 @@ Manager.prototype._dissect = function () {
|
||||
this._deferred.resolve(pkgMetas);
|
||||
};
|
||||
|
||||
Manager.prototype._getOrigin = function (decEndpoint) {
|
||||
return decEndpoint.name || decEndpoint.registryName || decEndpoint.resolverName;
|
||||
};
|
||||
|
||||
Manager.prototype._findHighestVersion = function (comparators) {
|
||||
var highest;
|
||||
var matches;
|
||||
@@ -403,4 +423,4 @@ Manager.prototype._findHighestVersion = function (comparators) {
|
||||
return highest;
|
||||
};
|
||||
|
||||
module.exports = Manager;
|
||||
module.exports = Manager;
|
||||
|
||||
Reference in New Issue
Block a user