minor remove improvements

This commit is contained in:
David Glasser
2014-07-24 16:49:12 -07:00
parent ab7e9366e1
commit a7cbc3bd87
2 changed files with 13 additions and 8 deletions

View File

@@ -1399,11 +1399,16 @@ main.registerCommand({
// user. Because removing each package is a completely atomic operation that
// has no chance of failure, this is just a warning message, it doesn't cause
// us to stop.
var packagesToRemove = [];
_.each(options.args, function (packageName) {
// Check that we are using the package. We don't check if the package
// exists. You should be able to remove non-existent packages.
if (! _.has(packages, packageName)) {
process.stderr.write( packageName + " is not in this project\n");
if (/@/.test(packageName)) {
process.stderr.write(packageName + ": do not specify version constraints.\n");
} else if (! _.has(packages, packageName)) {
// Check that we are using the package. We don't check if the package
// exists. You should be able to remove non-existent packages.
process.stderr.write(packageName + " is not in this project.\n");
} else {
packagesToRemove.push(packageName);
}
});
@@ -1415,7 +1420,7 @@ main.registerCommand({
// Remove the packages from the project! There is really no way for this to
// fail, unless something has gone horribly wrong, so we don't need to check
// for it.
project.removePackages(options.args);
project.removePackages(packagesToRemove);
// Retrieve the new dependency versions that we have chosen for this project
// and do some pretty output reporting.
@@ -1424,8 +1429,8 @@ main.registerCommand({
// Log that we removed the constraints. It is possible that there are
// constraints that we officially removed that the project still 'depends' on,
// which is why there are these two tiers of error messages.
_.each(options.args, function (packageName) {
process.stdout.write("Removed constraint " + packageName + " from project\n");
_.each(packagesToRemove, function (packageName) {
process.stdout.write("Removed top-level dependency on " + packageName + ".\n");
});
return 0;

View File

@@ -298,7 +298,7 @@ _.extend(Project.prototype, {
// Remove the versions that don't exist
var removed = _.difference(_.keys(versions), _.keys(newVersions));
_.each(removed, function(packageName) {
messageLog.push(" removed dependency on " + packageName);
messageLog.push(" removed " + packageName + " from project");
});
_.each(newVersions, function(version, packageName) {