Initial take on the commands + renderers + cli.

This commit is contained in:
André Cruz
2013-05-23 19:55:59 +01:00
parent 9f6bf62efc
commit cfb3d14028
21 changed files with 442 additions and 68 deletions

View File

@@ -40,18 +40,30 @@ GitResolver.prototype._hasNew = function (canonicalPkg, pkgMeta) {
GitResolver.prototype._resolve = function () {
var deferred = Q.defer();
deferred.notify({ type: 'action', data: 'Finding resolution' });
deferred.notify({
level: 'action',
tag: 'versions',
data: 'Finding resolution'
});
this._findResolution()
.then(function (resolution) {
deferred.notify({ type: 'action', data: 'Checking out "' + (resolution.tag || resolution.branch || resolution.commit) + '"' });
deferred.notify({
level: 'action',
tag: 'checkout',
data: 'Checking out "' + (resolution.tag || resolution.branch || resolution.commit) + '"'
});
return this._checkout()
// Always run cleanup after checkout to ensure that .git is removed!
// If it's not removed, problems might arise when the "tmp" module attempts
// to delete the temporary folder
.fin(function () {
deferred.notify({ type: 'action', data: 'Cleaning up' });
deferred.notify({
level: 'action',
tag: 'cleanup',
data: 'Cleaning up git artifacts'
});
return this._cleanup();
}.bind(this));
}.bind(this))
@@ -179,7 +191,8 @@ GitResolver.prototype._savePkgMeta = function (meta) {
if (typeof meta.version === 'string' && semver.neq(meta.version, version)) {
process.nextTick(function (metaVersion) {
deferred.notify({
type: 'warn',
level: 'warn',
tag: 'mismatch',
data: 'Version declared in the json (' + metaVersion + ') is different than the resolved one (' + version + ')'
});
}.bind(this, meta.version));
@@ -194,7 +207,7 @@ GitResolver.prototype._savePkgMeta = function (meta) {
}
// Save version/commit/branch/tag in the release
meta._release = version || this._resolution.tag || this._resolution.commit;
meta._release = version || this._resolution.tag || this._resolution.commit.substr(0, 10);
// Save resolution to be used in hasNew later
meta._resolution = this._resolution;