-
Notifications
You must be signed in to change notification settings - Fork 139
develop -> master #139
Changes from all commits
3b5a7ff
15af2c4
8a192b2
93bc64f
68618da
7f24f4e
377858e
55ea42a
d90f562
e70a49a
fe1b4b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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); |
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary fat arrow |
||
|
|
||
| triggerBuild: (params={}, fn = null) => | ||
| @debug "Projects::triggerBuild()" | ||
| @post "projects/#{Utils.parseProjectId params.projectId}/trigger/builds", params, null, (data) => fn data if fn | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary fat arrow |
||
|
|
||
| module.exports = (client) -> new ProjectBuilds client | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,10 @@ class ProjectRepository extends BaseModel | |
| @delete "projects/#{Utils.parseProjectId projectId}/repository/branches/#{encodeURI branchId}", (data) => fn data if fn | ||
|
|
||
| # === Tags | ||
| addTag: (params = {}, fn = null) => | ||
| @debug "Projects::addTag()" | ||
| @post "projects/#{Utils.parseProjectId params.id}/repository/tags", params, (data) => fn data if fn | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line exceeds maximum allowed length |
||
|
|
||
| listTags: (projectId, fn = null) => | ||
| @debug "Projects::listTags()" | ||
| @get "projects/#{Utils.parseProjectId projectId}/repository/tags", (data) => fn data if fn | ||
|
|
@@ -76,6 +80,10 @@ class ProjectRepository extends BaseModel | |
| @debug "Projects::updateFile()", params | ||
| @put "projects/#{Utils.parseProjectId params.projectId}/repository/files", params, (data) => fn data if fn | ||
|
|
||
| compare: (params = {}, fn = null) => | ||
| @debug "Projects::compare()", params | ||
| @get "projects/#{Utils.parseProjectId params.projectId}/repository/compare", params, (data) => fn data if fn | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line exceeds maximum allowed length |
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong count of newlines between a class and other code |
||
| ## TODO: | ||
| # - Raw file content | ||
| # - Raw blob content | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ class Projects extends BaseModel | |
| @deploy_keys = @load 'ProjectDeployKeys' | ||
| @merge_requests = @load 'ProjectMergeRequests' | ||
| @services = @load 'ProjectServices' | ||
| @builds = @load 'ProjectBuilds' | ||
|
|
||
| all: (params={}, fn=null) => | ||
| if 'function' is typeof params | ||
|
|
@@ -113,4 +114,8 @@ class Projects extends BaseModel | |
| @debug "Projects::search()" | ||
| @get "projects/search/#{projectName}", params, (data) => fn data if fn | ||
|
|
||
| listTriggers: (projectId, fn = null) => | ||
| @debug "Projects::listTriggers()" | ||
| @get "projects/#{Utils.parseProjectId projectId}/triggers", (data) => fn data if fn | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line exceeds maximum allowed length |
||
|
|
||
| module.exports = (client) -> new Projects client | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary fat arrow
Line exceeds maximum allowed length