Fix really weird bug that caused local packages to be installed.

This commit is contained in:
André Cruz
2013-07-05 01:46:52 +01:00
parent d8cef76592
commit 011a19772d

View File

@@ -108,17 +108,22 @@ Manager.prototype.install = function () {
var dst;
var release = decEndpoint.pkgMeta._release;
// Skip if source is the same as dest
dst = path.join(componentsDir, name);
if (dst === decEndpoint.canonicalDir) {
return;
}
that._logger.action('install', name + (release ? '#' + release : ''), that.toData(decEndpoint));
// Remove existent and copy canonical dir
dst = path.join(componentsDir, name);
decEndpoint.dst = dst;
promise = Q.nfcall(rimraf, dst)
.then(copy.copyDir.bind(copy, decEndpoint.canonicalDir, dst))
.then(function () {
var jsonFile = path.join(dst, '.bower.json');
decEndpoint.canonicalDir = dst;
// Store _target in bower.json
return Q.nfcall(fs.readFile, jsonFile)
.then(function (contents) {
@@ -138,9 +143,7 @@ Manager.prototype.install = function () {
.then(function () {
// Resolve with meaningful data
return mout.object.map(that._dissected, function (decEndpoint) {
var pkg = this.toData(decEndpoint);
pkg.canonicalDir = decEndpoint.dst;
return pkg;
return this.toData(decEndpoint);
}, that);
})
.fin(function () {
@@ -489,7 +492,7 @@ Manager.prototype._dissect = function () {
return !installedMeta ||
installedMeta._release !== decEndpoint.pkgMeta._release ||
installedMeta._target !== decEndpoint.target;
installedMeta._target !== decEndpoint.pkgMeta._target;
}, this);
// Resolve with meaningful data