From 4933c80d05f481269ab6f5dd1666ccf3aeb994eb Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Tue, 11 Aug 2015 13:59:15 +0200 Subject: [PATCH 1/3] Post-release version bump --- README.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a563ffe..459383b 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,11 @@ MIT Changelog ========= +1.5.0-dev (unrelease) +--------------------- + +- No entry + [1.4.0](https://github.com/node-gitlab/node-gitlab/tree/v1.4.0) (2015-08-11) ------------------ diff --git a/package.json b/package.json index 623cdac..ceb8649 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitlab", - "version": "1.4.0", + "version": "1.5.0-dev", "description": "GitLab API Nodejs library.", "main": "lib/index.js", "directories": { From 574a2c3de114732c8826587f603071097043785d Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Thu, 20 Aug 2015 03:45:21 +0200 Subject: [PATCH 2/3] Coffee rebuild --- examples/show-project.js | 8 ++++++ lib/ApiBaseHTTP.js | 8 +----- lib/Models/ProjectMilestones.js | 48 +++++++++++++++++++++++++++------ 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/examples/show-project.js b/examples/show-project.js index c1bea0a..df2f87a 100755 --- a/examples/show-project.js +++ b/examples/show-project.js @@ -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); diff --git a/lib/ApiBaseHTTP.js b/lib/ApiBaseHTTP.js index 807d670..6c65459 100644 --- a/lib/ApiBaseHTTP.js +++ b/lib/ApiBaseHTTP.js @@ -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: diff --git a/lib/Models/ProjectMilestones.js b/lib/Models/ProjectMilestones.js index b01231c..8ae0082 100644 --- a/lib/Models/ProjectMilestones.js +++ b/lib/Models/ProjectMilestones.js @@ -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) { From b7b1a6d95b2b72a6edd1ae0b18efeab7f77548b5 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Thu, 20 Aug 2015 03:46:29 +0200 Subject: [PATCH 3/3] v1.4.1 --- README.md | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 459383b..8554a03 100644 --- a/README.md +++ b/README.md @@ -116,10 +116,10 @@ MIT Changelog ========= -1.5.0-dev (unrelease) ---------------------- +1.4.1 (2015-08-11) +------------------ -- No entry +- Coffee rebuild [1.4.0](https://github.com/node-gitlab/node-gitlab/tree/v1.4.0) (2015-08-11) ------------------ diff --git a/package.json b/package.json index ceb8649..05b7095 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitlab", - "version": "1.5.0-dev", + "version": "1.4.1", "description": "GitLab API Nodejs library.", "main": "lib/index.js", "directories": {