Comparing version 0.0.10 to 0.0.11
@@ -6,13 +6,25 @@ var crypto = require('crypto'); | ||
console.log(new Date() + ': Get latest sha - started'); | ||
return user.provider.getCommits(repoOwner, repoName, branch, 1) | ||
.then(function (commitInfo) { | ||
console.log(new Date() + ': Get latest sha - ended - success'); | ||
return (commitInfo && commitInfo.length === 1) ? | ||
commitInfo[0].sha : | ||
branch; | ||
return getLatestSha(user, repoOwner, repoName, branch) | ||
.then(function (commit) { | ||
if (commit === null) { | ||
return branch; | ||
} | ||
else { | ||
return commit.sha; | ||
} | ||
}); | ||
} | ||
function getLatestCommit(user, repoOwner, repoName, branch) { | ||
console.log(new Date() + ': Get latest commit - started'); | ||
return user.provider.getCommits(repoOwner, repoName, branch, 1) | ||
.then(function (commitInfo) { | ||
console.log(new Date() + ': Get latest commit - ended - success'); | ||
return (commitInfo && commitInfo.length === 1) ? | ||
commitInfo[0] : null; | ||
}); | ||
} | ||
var prepareHashInfo = function(repoOwner, repoName, branch, latestSha, settings) { | ||
@@ -69,3 +81,4 @@ | ||
prepareHashInfo: prepareHashInfo, | ||
getLatestSha: getLatestSha | ||
getLatestSha: getLatestSha, | ||
getLatestCommit: getLatestCommit | ||
}; |
{ | ||
"name": "cf-common", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "common modules for codefresh runtime and api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2896
69