diff --git a/index.html b/index.html
index 2a14695..f372d0b 100644
--- a/index.html
+++ b/index.html
@@ -172,6 +172,10 @@ I made the GitHub Badge Service.
 |
http://img.shields.io/appveyor/ci/gruntjs/grunt.svg |
+ Codeship: |
+  |
+ http://img.shields.io/codeship/d6c1ddd0-16a3-0132-5f85-2e35c05e22b1.svg |
+
Coveralls: |
 |
http://img.shields.io/coveralls/jekyll/jekyll.svg |
diff --git a/package.json b/package.json
index d11ff30..aa59cdf 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
"semver": "~2.3.0"
},
"devDependencies": {
- "ass": "~0.0.4",
+ "ass": "~0.0.6",
"should": "~3.0.0",
"mocha": "~1.14.0"
},
diff --git a/server.js b/server.js
index bc9132d..9b853e4 100644
--- a/server.js
+++ b/server.js
@@ -1662,6 +1662,58 @@ cache(function(data, match, sendBadge) {
});
}));
+// Codeship.io integration
+camp.route(/^\/codeship\/(.+)\.(svg|png|gif|jpg)$/,
+cache(function(data, match, sendBadge) {
+ var projectId = match[1]; // eg, `ab123456-00c0-0123-42de-6f98765g4h32`.
+ var format = match[2];
+ var options = {
+ method: 'GET',
+ uri: 'https://www.codeship.io/projects/' + projectId + '/status'
+ };
+ var badgeData = getBadgeData('build', data);
+ request(options, function(err, res) {
+ if (err != null) {
+ badgeData.text[1] = 'inaccessible';
+ sendBadge(format, badgeData);
+ }
+ try {
+ var statusMatch = res.headers['content-disposition']
+ .match(/filename="status_(.+)\.png"/);
+ if (!statusMatch) {
+ badgeData.text[1] = 'unknown';
+ sendBadge(format, badgeData);
+ return;
+ }
+
+ switch (statusMatch[1]) {
+ case 'success':
+ badgeData.text[1] = 'passed';
+ badgeData.colorscheme = 'brightgreen';
+ break;
+ case 'projectnotfound':
+ badgeData.text[1] = 'not found';
+ break;
+ case 'testing':
+ case 'waiting':
+ badgeData.text[1] = 'pending';
+ break;
+ case 'error':
+ badgeData.text[1] = 'failing';
+ badgeData.colorscheme = 'red';
+ break;
+ case 'stopped':
+ badgeData.text[1] = 'not built';
+ break;
+ }
+ sendBadge(format, badgeData);
+ } catch(e) {
+ badgeData.text[1] = 'not found';
+ sendBadge(format, badgeData);
+ }
+ });
+}));
+
// Maven-Central artifact version integration
// API documentation: http://search.maven.org/#api
camp.route(/^\/maven-central\/v\/(.*)\/(.*)\.(svg|png|gif|jpg)$/,
diff --git a/try.html b/try.html
index 23cbbf4..da74573 100644
--- a/try.html
+++ b/try.html
@@ -171,6 +171,10 @@ I made the GitHub Badge Service.
 |
http://img.shields.io/appveyor/ci/gruntjs/grunt.svg |
+ Codeship: |
+  |
+ http://img.shields.io/codeship/d6c1ddd0-16a3-0132-5f85-2e35c05e22b1.svg |
+
Coveralls: |
 |
http://img.shields.io/coveralls/jekyll/jekyll.svg |
---|