Created
December 3, 2015 12:47
-
-
Save marcsolanadal/b50a30d6061aaa99b872 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a new git repo on Stash using their API | |
* | |
* @method createStashRepo | |
* @param {string} repoName Name of the repo to create | |
* @returns {promise} | |
*/ | |
createStashRepo: function (repoName) { | |
var repoOptions = { | |
"name": repoName, | |
"scmId": "git" | |
}; | |
var defer = q.defer(); | |
console.log('Creating repo with name ' + repoName); | |
restler.postJson(settings.git.urlApi, repoOptions, this.authHeader) | |
.on('success', function (res) { | |
//defer.resolve(res.cloneUrl); | |
// get the ssh url | |
var index = _.findIndex(res.links.clone, {'name': 'ssh'}), | |
href = res.links.clone[index].href; | |
// TODO: Remove when Stash ssh access solved | |
href = href.replace('git.atsistemas.com', '192.168.1.220'); | |
defer.resolve(href); | |
}) | |
.on('fail', defer.reject); | |
return defer.promise; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment