Move --force tests from the package to the manager.

This commit is contained in:
André Cruz
2012-10-21 11:48:50 +01:00
parent f50520e04e
commit 8fe0abfc4b
3 changed files with 42 additions and 52 deletions

View File

@@ -34,21 +34,12 @@ var readJSON = require('../util/read-json');
var UnitWork = require('./unit_work');
var Package = function (name, endpoint, manager) {
this.dependencies = {};
this.json = {};
this.name = name;
// The third argument can be a manager or an options object
// If its a manager, the opts & unit of work are grabbed from it
// We can't use the instanceof because of a circular reference between the two packages
if (manager && manager.unitWork) {
this.manager = manager;
this.unitWork = manager.unitWork;
this.opts = manager.opts;
} else {
this.unitWork = new UnitWork;
this.opts = _.extend({ force: false }, manager);
}
this.dependencies = {};
this.json = {};
this.name = name;
this.manager = manager;
this.unitWork = manager ? manager.unitWork : new UnitWork;
this.opts = manager ? manager.opts : {};
if (endpoint) {