Comparing version 0.8.1 to 0.8.2
# Changelog | ||
## 0.8.2 - 2013-02-26 | ||
- Fix some errors in windows related, had to downgrade `rimraf` ([#274](https://github.com/twitter/bower/issues/274)) | ||
- Prevent duplicate package names in error summaries ([#277](https://github.com/twitter/bower/issues/277)) | ||
## 0.8.1 - 2013-02-25 | ||
@@ -4,0 +9,0 @@ |
@@ -112,7 +112,7 @@ // ========================================== | ||
var pkg = new Package(name, dir, this); | ||
this.dependencies[name] = []; | ||
this.dependencies[name].push(pkg); | ||
pkg.once('error', function (err, origin) { | ||
this.errors.push({ pkg: origin || pkg, error: err }); | ||
}.bind(this)); | ||
this.gatherPackageErrors(pkg); | ||
}.bind(this)); | ||
@@ -131,10 +131,9 @@ this.emit('resolveLocal'); | ||
var pkg = new Package(name, endpoint, this); | ||
pkg.root = true; | ||
this.dependencies[name] = this.dependencies[name] || []; | ||
this.dependencies[name].push(pkg); | ||
pkg.once('error', function (err, origin) { | ||
this.errors.push({ pkg: origin || pkg, error: err }); | ||
next(); | ||
}.bind(this)); | ||
pkg.once('resolve', next).resolve(); | ||
this.gatherPackageErrors(pkg, next); | ||
}.bind(this), this.emit.bind(this, 'resolveEndpoints')); | ||
@@ -161,7 +160,5 @@ | ||
this.dependencies[name].push(pkg); | ||
pkg.once('error', function (err, origin) { | ||
this.errors.push({ pkg: origin || pkg, error: err }); | ||
next(); | ||
}.bind(this)); | ||
pkg.once('resolve', next).resolve(); | ||
this.gatherPackageErrors(pkg, next); | ||
}.bind(this), this.emit.bind(this, 'resolveFromJson')); | ||
@@ -221,2 +218,24 @@ }.bind(this)).loadJSON(); | ||
Manager.prototype.gatherPackageErrors = function (pkg, next) { | ||
var calledNext = false; | ||
// Listen to all the errors | ||
// The first error will call the next callback and we continue to gather more until the end | ||
// This makes sense because a package forwards its deep dependencies errors | ||
pkg.on('error', function (err, origin) { | ||
pkg = origin || pkg; | ||
// If the error message starts with the package name, strip it | ||
if (!err.message.indexOf(pkg.name + ' ')) { | ||
err.message = err.message.substr(pkg.name.length + 1); | ||
} | ||
this.errors.push({ pkg: pkg, error: err }); | ||
if (next && !calledNext) { | ||
calledNext = true; | ||
next(); | ||
} | ||
}.bind(this)); | ||
}; | ||
Manager.prototype.install = function () { | ||
@@ -246,5 +265,4 @@ async.forEach(Object.keys(this.dependencies), function (name, next) { | ||
Manager.prototype.reportErrors = function () { | ||
this.muteDependencies(); | ||
template('error-summary', { errors: this.errors }).on('data', function (data) { | ||
this.muteDependencies(); | ||
this.emit('data', data); | ||
@@ -294,3 +312,4 @@ this.emit('resolve', false); | ||
// used in list command | ||
// Used in list command | ||
// TODO: not sure if this belongs here.. maybe move it to the list command? | ||
Manager.prototype.list = function (options) { | ||
@@ -320,7 +339,7 @@ options = options || {}; | ||
values = _.values(packages); | ||
// do not proceed if no values | ||
// Do not proceed if no values | ||
if (!values.length) { | ||
return packages; | ||
} | ||
// load JSON and get version for each package | ||
// Load JSON and get version for each package | ||
async.forEach(values, function (pkg, next) { | ||
@@ -327,0 +346,0 @@ pkg.once('loadJSON', function () { |
@@ -115,4 +115,5 @@ // ========================================== | ||
this.on('error', function (err, origin) { | ||
// Unlock the unit of work automatically on error | ||
// Unlock the unit of work automatically on error (only if the error is from this package) | ||
if (!origin && this.unitWork.isLocked(this.name)) this.unitWork.unlock(this.name, this); | ||
// Propagate the error event to the parent package/manager | ||
this.manager.emit('error', err, origin || this); | ||
@@ -564,3 +565,6 @@ }.bind(this)); | ||
}.bind(this)); | ||
async.parallel(callbacks, this.emit.bind(this, 'resolve')); | ||
async.parallel(callbacks, function (err) { | ||
if (err) return this.emit('error', err); | ||
this.emit('resolve'); | ||
}.bind(this)); | ||
}; | ||
@@ -567,0 +571,0 @@ |
{ | ||
"name": "bower", | ||
"description": "The browser package manager.", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"author": "Twitter", | ||
@@ -24,3 +24,3 @@ "licenses": [ | ||
"colors": "~0.6.0-1", | ||
"rimraf": "~2.1.4", | ||
"rimraf": "~2.0.3", | ||
"mkdirp": "~0.3.4", | ||
@@ -27,0 +27,0 @@ "semver": "~1.1.0", |
@@ -37,12 +37,8 @@ /*jshint plusplus:false*/ | ||
beforeEach(function (done) { | ||
clean(function () { | ||
process.chdir(cwd); | ||
done(); | ||
}); | ||
process.chdir(cwd); | ||
clean(done); | ||
}); | ||
after(function (done) { | ||
clean(function () { | ||
process.chdir(cwd); | ||
done(); | ||
}); | ||
process.chdir(cwd); | ||
clean(done); | ||
}); | ||
@@ -49,0 +45,0 @@ |
@@ -30,2 +30,28 @@ /*jshint plusplus: false */ | ||
// function to normalize paths because in windows the separator is \\ instead of / | ||
function normalize(target) { | ||
var key, | ||
newObj; | ||
if (typeof target === 'string') { | ||
return target.replace(/\\/g, '/'); | ||
} | ||
if (Array.isArray(target)) { | ||
return target.map(function (item) { | ||
return normalize(item); | ||
}); | ||
} | ||
newObj = {}; | ||
for (key in target) { | ||
newObj[key] = normalize(target[key]); | ||
} | ||
return newObj; | ||
} | ||
beforeEach(clean); | ||
after(clean); | ||
it('Should have line method', function () { | ||
@@ -41,5 +67,8 @@ assert(typeof list.line === 'function'); | ||
manager | ||
.on('error', function (err) { | ||
throw err; | ||
}) | ||
.on('resolve', function () { | ||
list({ paths: true }).on('data', function (data) { | ||
assert.deepEqual(data, { | ||
assert.deepEqual(normalize(data), { | ||
a: ['components/a/a.js', 'components/a/a.css'], | ||
@@ -56,3 +85,4 @@ a1: 'components/a1/a1.js', | ||
}); | ||
clean(next); | ||
next(); | ||
}); | ||
@@ -69,5 +99,8 @@ }) | ||
manager | ||
.on('error', function (err) { | ||
throw err; | ||
}) | ||
.on('resolve', function () { | ||
list({ map: true }).on('data', function (data) { | ||
assert(data, { | ||
assert(normalize(data), { | ||
jquery: { | ||
@@ -103,5 +136,8 @@ source: { | ||
manager | ||
.on('error', function (err) { | ||
throw err; | ||
}) | ||
.on('resolve', function () { | ||
list({ sources: true }).on('data', function (data) { | ||
assert.deepEqual(data, { | ||
assert.deepEqual(normalize(data), { | ||
'.js': [ | ||
@@ -108,0 +144,0 @@ 'components/a1/a1.js', |
@@ -472,3 +472,3 @@ /*jshint plusplus:false*/ | ||
it('Should extract tar and zip files from normal URL packages', function (next) { | ||
var pkg = new Package('jquery', 'http://github.com/satazor/SparkMD5/archive/master.zip'); | ||
var pkg = new Package('spark-md5', 'https://github.com/satazor/SparkMD5/archive/master.zip'); | ||
@@ -475,0 +475,0 @@ pkg.on('resolve', function () { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
368102
4995
+ Addedgraceful-fs@1.1.14(transitive)
+ Addedrimraf@2.0.3(transitive)
- Removedrimraf@2.1.4(transitive)
Updatedrimraf@~2.0.3