Skip to content

Commit efd8e96

Browse files
Merge branch 'master' of github.com:Strider-CD/strider-gitlab
2 parents 52e5664 + 675655c commit efd8e96

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

lib/api.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var _ = require('lodash');
22
var async = require('async');
33
var superagent = require('superagent');
4+
var debug = require('debug')('strider-gitlab:api');
45

56
module.exports = {
67
get: get,
@@ -38,6 +39,8 @@ function get(config, uri, done) {
3839
.set('User-Agent', 'StriderCD (http://stridercd.com)')
3940
.end(function (error, res) {
4041
res = res || {};
42+
debug('Response body type: ' + typeof res.body);
43+
debug('Response body received: ' + JSON.stringify(res.body));
4144
if (res.error) {
4245
return done(res.error, null, res);
4346
}

lib/webapp.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var api = require('./api');
33
var async = require('async');
44
var util = require('util');
55
var webhooks = require('./webhooks');
6-
6+
var debug = require('debug')('strider-gitlab:webapp');
77
var hostname = process.env.strider_server_name || 'http://localhost:3000';
88

99
module.exports = {
@@ -30,7 +30,9 @@ module.exports = {
3030
api.get(config, 'projects', function (err, repos) {
3131
if (err) return done(err);
3232

33-
repos = JSON.parse(repos);
33+
if(!repos) {
34+
return done(new Error("Could not get a list of projects from the GitLab repository. Please check the configuration in Account->GitLab."));
35+
}
3436

3537
// Parse and filter only git repos
3638
done(null, repos.map(api.parseRepo).filter(function (repo) {
@@ -55,9 +57,9 @@ module.exports = {
5557

5658
var uri = util.format('projects/%d/repository/branches', repo_id);
5759

60+
debug("Getting URI " + uri);
5861
api.get(account, uri, function (err, branches) {
59-
60-
branches = JSON.parse(branches);
62+
debug("We get the following as branches: " + JSON.stringify(branches));
6163

6264
done(err, _.map(branches || [], function (branch) {
6365
return branch.name

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strider-gitlab",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "A gitlab provider for strider",
55
"repository": {
66
"type": "git",
@@ -42,7 +42,7 @@
4242
"gravatar": "^1.0.6",
4343
"lodash": "~2.2.0",
4444
"step": "0.0.5",
45-
"strider-git": "^0.2.3",
45+
"strider-git": "^0.2.4",
4646
"superagent": "~0.15.4"
4747
},
4848
"bugs": {

0 commit comments

Comments
 (0)