Some more refactoring.

This commit is contained in:
André Cruz
2013-04-14 18:01:33 +01:00
parent 8f24858af8
commit 3dbdb541ed
3 changed files with 15 additions and 16 deletions

View File

@@ -26,8 +26,7 @@ GitFsResolver.prototype._resolveSelf = function () {
return this._copy()
.then(this._fetch.bind(this))
.then(this._findResolution.bind(this))
.then(this._checkout.bind(this));
.then(GitResolver.prototype._resolveSelf.bind(this));
};
// -----------------

View File

@@ -13,13 +13,6 @@ mout.object.mixIn(GitRemoteResolver, GitResolver);
// -----------------
GitRemoteResolver.prototype._resolveSelf = function () {
this._sourcePath = this._source;
return this._findResolution()
.then(this._checkout.bind(this));
};
GitRemoteResolver.prototype._checkout = function (resolution) {
var dir = this._tempDir,
branch;

View File

@@ -18,6 +18,11 @@ util.inherits(GitResolver, Resolver);
// -----------------
GitResolver.prototype._resolveSelf = function () {
return this._findResolution()
.then(this._checkout.bind(this));
};
GitResolver.prototype.hasNew = function (oldTarget, oldResolution) {
return this._findResolution()
.then(function (resolution) {
@@ -38,9 +43,16 @@ GitResolver.prototype.hasNew = function (oldTarget, oldResolution) {
});
};
// -----------------
// Abstract functions that should be implemented by concrete git resolvers
GitResolver.prototype._checkout = function () {};
GitResolver.fetchRefs = function (source) {};
// -----------------
GitResolver.prototype._findResolution = function () {
var promise,
branches,
var branches,
target,
self = this.constructor;
@@ -89,11 +101,6 @@ GitResolver.prototype._findResolution = function () {
// ------------------------------
// Abstract function, should be implemented by concrete git resolvers
GitResolver.fetchRefs = function (source) {};
// ------------------------------
GitResolver.fetchVersions = function (source) {
if (this._versions && this._versions[source]) {
return Q.resolve(this._versions[source]);