Skip to content
This repository has been archived by the owner on Oct 24, 2019. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  v1.4.1
  Coffee rebuild
  Post-release version bump
  • Loading branch information
moul committed Aug 20, 2015
2 parents 39cbeb7 + b7b1a6d commit b1bdff7
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 16 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ MIT
Changelog
=========

1.4.1 (2015-08-11)
------------------

- Coffee rebuild

[1.4.0](https://github.com/node-gitlab/node-gitlab/tree/v1.4.0) (2015-08-11)
------------------

Expand Down
8 changes: 8 additions & 0 deletions examples/show-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@
return console.log(members);
});

gitlab.projects.milestones.list(projectId, {
per_page: 100
}, function(milestones) {
console.log("");
console.log("=== Milestones ===");
return console.log(milestones);
});

}).call(this);
8 changes: 1 addition & 7 deletions lib/ApiBaseHTTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@
ApiBaseHTTP.prototype.fn_wrapper = function(fn) {
return (function(_this) {
return function(err, response, ret) {
var arity, ref;
if (err) {
debug('an error has occured', err);
if ((400 <= (ref = err.statusCode) && ref <= 499)) {
throw "Authorisation error. " + err.statusCode + ". Check your key.";
}
}
var arity;
arity = fn.length;
switch (arity) {
case 1:
Expand Down
48 changes: 40 additions & 8 deletions lib/Models/ProjectMilestones.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,60 @@
Utils = require('../Utils');

ProjectMilestones = (function(superClass) {
var list;

extend(ProjectMilestones, superClass);

function ProjectMilestones() {
this.update = bind(this.update, this);
this.add = bind(this.add, this);
this.show = bind(this.show, this);
this.list = bind(this.list, this);
this.all = bind(this.all, this);
return ProjectMilestones.__super__.constructor.apply(this, arguments);
}

ProjectMilestones.prototype.list = function(projectId, fn) {
list = function(projectId, fn) {
if (fn == null) {
fn = null;
}
this.debug("Projects::milestones()");
return this.get("projects/" + (Utils.parseProjectId(projectId)) + "/milestones", (function(_this) {
return function(data) {
if (fn) {
return fn(data);
console.log('DEPRECATED: milestone.list. Use milestone.all instead');
return this.all.apply(this, arguments);
};

ProjectMilestones.prototype.all = function(projectId, fn) {
var cb, data, params;
if (fn == null) {
fn = null;
}
this.debug("Projects::Milestones::all()");
params = {};
if (params.page == null) {
params.page = 1;
}
if (params.per_page == null) {
params.per_page = 100;
}
data = [];
cb = (function(_this) {
return function(err, retData) {
if (err) {
if (fn) {
return fn(retData || data);
}
} else if (retData.length === params.per_page) {
_this.debug("Recurse Projects::Milestones::all()");
data = data.concat(retData);
params.page++;
return _this.get("projects/" + (Utils.parseProjectId(projectId)) + "/milestones", params, cb);
} else {
data = data.concat(retData);
if (fn) {
return fn(data);
}
}
};
})(this));
})(this);
return this.get("projects/" + (Utils.parseProjectId(projectId)) + "/milestones", params, cb);
};

ProjectMilestones.prototype.show = function(projectId, milestoneId, fn) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gitlab",
"version": "1.4.0",
"version": "1.4.1",
"description": "GitLab API Nodejs library.",
"main": "lib/index.js",
"directories": {
Expand Down

0 comments on commit b1bdff7

Please sign in to comment.