This repository has been archived by the owner on Oct 24, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from node-gitlab/develop
develop -> master
- Loading branch information
Showing
12 changed files
with
233 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
(function() { | ||
var BaseModel, ProjectBuilds, Utils, | ||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
|
||
BaseModel = require('../BaseModel'); | ||
|
||
Utils = require('../Utils'); | ||
|
||
ProjectBuilds = (function(superClass) { | ||
extend(ProjectBuilds, superClass); | ||
|
||
function ProjectBuilds() { | ||
this.triggerBuild = bind(this.triggerBuild, this); | ||
this.showBuild = bind(this.showBuild, this); | ||
this.listBuilds = bind(this.listBuilds, this); | ||
return ProjectBuilds.__super__.constructor.apply(this, arguments); | ||
} | ||
|
||
ProjectBuilds.prototype.listBuilds = function(projectId, fn) { | ||
if (fn == null) { | ||
fn = null; | ||
} | ||
this.debug("Projects::listBuilds()"); | ||
return this.get("projects/" + (Utils.parseProjectId(projectId)) + "/builds", (function(_this) { | ||
return function(data) { | ||
if (fn) { | ||
return fn(data); | ||
} | ||
}; | ||
})(this)); | ||
}; | ||
|
||
ProjectBuilds.prototype.showBuild = function(projectId, buildId, fn) { | ||
if (fn == null) { | ||
fn = null; | ||
} | ||
this.debug("Projects::build()"); | ||
return this.get("projects/" + (Utils.parseProjectId(projectId)) + "/builds/" + buildId, null, (function(_this) { | ||
return function(data) { | ||
if (fn) { | ||
return fn(data); | ||
} | ||
}; | ||
})(this)); | ||
}; | ||
|
||
ProjectBuilds.prototype.triggerBuild = function(params, fn) { | ||
if (params == null) { | ||
params = {}; | ||
} | ||
if (fn == null) { | ||
fn = null; | ||
} | ||
this.debug("Projects::triggerBuild()"); | ||
return this.post("projects/" + (Utils.parseProjectId(params.projectId)) + "/trigger/builds", params, null, (function(_this) { | ||
return function(data) { | ||
if (fn) { | ||
return fn(data); | ||
} | ||
}; | ||
})(this)); | ||
}; | ||
|
||
return ProjectBuilds; | ||
|
||
})(BaseModel); | ||
|
||
module.exports = function(client) { | ||
return new ProjectBuilds(client); | ||
}; | ||
|
||
}).call(this); |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
BaseModel = require '../BaseModel' | ||
Utils = require '../Utils' | ||
|
||
class ProjectBuilds extends BaseModel | ||
|
||
# === Builds | ||
listBuilds: (projectId, fn = null) => | ||
@debug "Projects::listBuilds()" | ||
@get "projects/#{Utils.parseProjectId projectId}/builds", (data) => fn data if fn | ||
|
||
showBuild: (projectId, buildId, fn = null) => | ||
@debug "Projects::build()" | ||
@get "projects/#{Utils.parseProjectId projectId}/builds/#{buildId}", null, (data) => fn data if fn | ||
|
||
triggerBuild: (params={}, fn = null) => | ||
@debug "Projects::triggerBuild()" | ||
@post "projects/#{Utils.parseProjectId params.projectId}/trigger/builds", params, null, (data) => fn data if fn | ||
|
||
module.exports = (client) -> new ProjectBuilds client |
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
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
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
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
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
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