This repository has been archived by the owner on Jul 19, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating Gitignore to account for Idea projects
- Loading branch information
Showing
14 changed files
with
108 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
coverage | ||
.DS_Store | ||
.DS_Store | ||
.idea |
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,9 @@ | ||
{ | ||
"body": { | ||
"project_name": "ExampleProject/example-client (branchname)", | ||
"stage_name": "Test", | ||
"counter": 1, | ||
"build_result": "errored" | ||
}, | ||
"headers": {} | ||
} |
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,9 @@ | ||
{ | ||
"body": { | ||
"project_name": "ExampleProject/example-client (branchname)", | ||
"stage_name": "Test", | ||
"counter": 1, | ||
"build_result": "Failed" | ||
}, | ||
"headers": {} | ||
} |
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,9 @@ | ||
{ | ||
"body": { | ||
"project_name": "ExampleProject/example-client (branchname)", | ||
"stage_name": "Test", | ||
"counter": 1, | ||
"build_result": "Passed" | ||
}, | ||
"headers": {} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,38 @@ | ||
/*jshint globalstrict:true, trailing:false, unused:true, node:true */ | ||
"use strict"; | ||
|
||
var parse = function (headers, body) { | ||
var projectName = body.project_name.split(" ")[0]; | ||
var branch = body.project_name.split(" ")[1].replace(/\(([\-a-zA-Z0-9]+)\)/g, "\$1"); | ||
var buildURL = "https://snap-ci.com/{0}/branch/{1}" | ||
.replace("{0}", projectName) | ||
.replace("{1}", branch); | ||
var message = "{0} Stage for project {1} [{3}]({2})" | ||
.replace("{0}", body.stage_name) | ||
.replace("{1}", projectName) | ||
.replace("{2}", buildURL); | ||
return { | ||
"passed": { | ||
icon: "smile", | ||
errorLevel: "normal", | ||
message: message.replace("{3}", "Passed") | ||
}, | ||
"failed": { | ||
icon: "frown", | ||
errorLevel: "error", | ||
message: message.replace("{3}", "Failed") | ||
}, | ||
"errored": { | ||
icon: "frown", | ||
errorLevel: "error", | ||
message: message.replace("{3}", "Errored") | ||
} | ||
}[body.build_result.toLocaleLowerCase()]; | ||
|
||
}; | ||
|
||
module.exports = { | ||
apiVersion: 1, | ||
name: 'SnapCI', | ||
parse: parse | ||
}; |
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,3 @@ | ||
You need to configure your Snap CI job to send [Webhook notifications](https://docs.snap-ci.com/notifications/webhook-notifications/). | ||
|
||
Add your Gitter webhook URL to Snap-CI's Notification Settings for your project. |
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,3 @@ | ||
{ | ||
"events": [] | ||
} |
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,35 @@ | ||
var assert = require('assert'); | ||
var snapciParse = require('../index').parse; | ||
var failedJson = require('../examples/failed.json'); | ||
var passedJson = require('../examples/passed.json'); | ||
var erroredJson = require('../examples/errored.json'); | ||
|
||
describe('Snap CI', function () { | ||
|
||
it('should generate a build passed message', function () { | ||
var parsedResponse = snapciParse(passedJson.headers, passedJson.body); | ||
assert.equal(parsedResponse.icon, "smile"); | ||
assert.equal(parsedResponse.message, "Test Stage for project ExampleProject/example-client [Passed](https://snap-ci.com/ExampleProject/example-client/branch/branchname)"); | ||
assert.equal(parsedResponse.errorLevel, "normal"); | ||
}); | ||
|
||
it('should generate a build failed message', function () { | ||
var parsedResponse = snapciParse(failedJson.headers, failedJson.body); | ||
assert.equal(parsedResponse.icon, "frown"); | ||
assert.equal(parsedResponse.message, "Test Stage for project ExampleProject/example-client [Failed](https://snap-ci.com/ExampleProject/example-client/branch/branchname)"); | ||
assert.equal(parsedResponse.errorLevel, "error"); | ||
}); | ||
|
||
it('should generate a build errored message', function () { | ||
var parsedResponse = snapciParse(erroredJson.headers, erroredJson.body); | ||
assert.equal(parsedResponse.icon, "frown"); | ||
assert.equal(parsedResponse.message, "Test Stage for project ExampleProject/example-client [Errored](https://snap-ci.com/ExampleProject/example-client/branch/branchname)"); | ||
assert.equal(parsedResponse.errorLevel, "error"); | ||
}); | ||
|
||
it('should be undefined for an build unknown hook call', function () { | ||
erroredJson.body.build_result = "anfasnknd"; | ||
var parsedResponse = snapciParse(erroredJson.headers, erroredJson.body); | ||
assert.equal(parsedResponse, undefined); | ||
}); | ||
}); |