Bountysource support

Closes #289
This commit is contained in:
Thaddee Tyl 2014-11-05 09:37:17 +01:00
parent 30979021dc
commit 4407d4c977
2 changed files with 98 additions and 66 deletions

View File

@ -497,6 +497,37 @@ cache(function(data, match, sendBadge, request) {
});
}));
// Bountysource integration.
camp.route(/^\/bountysource\/team\/([^\/]+)\/([^\/]+)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var team = match[1]; // eg, `mozilla-core`.
var type = match[2]; // eg, `activity`.
var format = match[3];
var url = 'https://api.bountysource.com/teams/' + team;
var options = {
headers: { 'Accept': 'application/vnd.bountysource+json; version=2' } };
var badgeData = getBadgeData('bounties', data);
request(url, options, function dealWithData(err, res, buffer) {
if (err != null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
}
try {
var data = JSON.parse(buffer);
if (type === 'activity') {
var activity = data.activity_total;
badgeData.colorscheme = 'brightgreen';
badgeData.text[1] = activity;
}
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);
}
});
}));
// HHVM integration.
camp.route(/^\/hhvm\/([^\/]+\/[^\/]+)(\/.+)?\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {

133
try.html
View File

@ -89,69 +89,6 @@ I made the GitHub Badge Service.
<h2> Supported Services </h2>
<h3> Miscellaneous </h3>
<table><tbody>
<tr><th> Gratipay: </th>
<td><img src='/gratipay/JSFiddle.svg' alt=''/></td>
<td><code>http://img.shields.io/gratipay/JSFiddle.svg</code></td>
</tr>
<tr><th> Code Climate: </th>
<td><img src='/codeclimate/github/kabisaict/flow.svg' alt=''/></td>
<td><code>http://img.shields.io/codeclimate/github/kabisaict/flow.svg</code></td>
</tr>
<tr><th> Code Climate: </th>
<td><img src='/codeclimate/coverage/github/triAGENS/ashikawa-core.svg' alt=''/></td>
<td><code>http://img.shields.io/codeclimate/coverage/github/triAGENS/ashikawa-core.svg</code></td>
</tr>
<tr><th> Gemnasium: </th>
<td><img src='/gemnasium/mathiasbynens/he.svg' alt=''/></td>
<td><code>http://img.shields.io/gemnasium/mathiasbynens/he.svg</code></td>
</tr>
<tr><th> David: </th>
<td><img src='/david/strongloop/express.svg' alt=''/></td>
<td><code>http://img.shields.io/david/strongloop/express.svg</code></td>
</tr>
<tr><th> David: </th>
<td><img src='/david/dev/strongloop/express.svg' alt=''/></td>
<td><code>http://img.shields.io/david/dev/strongloop/express.svg</code></td>
</tr>
<tr><th> David: </th>
<td><img src='/david/peer/webcomponents/generator-element.svg' alt=''/></td>
<td><code>http://img.shields.io/david/peer/webcomponents/generator-element.svg</code></td>
</tr>
<tr><th> Hackage-Deps: </th>
<td><img src='/hackage-deps/v/lens.svg' alt=''/></td>
<td><code>http://img.shields.io/hackage-deps/v/lens.svg</code></td>
</tr>
<tr><th> Packagist: </th>
<td><img src='/packagist/l/doctrine/orm.svg' alt=''/></td>
<td><code>http://img.shields.io/packagist/l/doctrine/orm.svg</code></td>
</tr>
<tr><th> npm: </th>
<td><img src='/npm/l/express.svg' alt=''/></td>
<td><code>http://img.shields.io/npm/l/express.svg</code></td>
</tr>
<tr><th> PyPI: </th>
<td><img src='/pypi/l/Django.svg' alt=''/></td>
<td><code>http://img.shields.io/pypi/l/Django.svg</code></td>
</tr>
<tr><th> Hex.pm: </th>
<td><img src='/hexpm/l/plug.svg' alt=''/></td>
<td><code>http://img.shields.io/hexpm/l/plug.svg</code></td>
</tr>
<tr><th> CocoaPods: </th>
<td><img src='/cocoapods/l/AFNetworking.svg' alt='' /></td>
<td><code>http://img.shields.io/cocoapods/l/AFNetworking.svg</code></td>
</tr>
<tr><th> CocoaPods: </th>
<td><img src='/cocoapods/p/AFNetworking.svg' alt='' /></td>
<td><code>http://img.shields.io/cocoapods/p/AFNetworking.svg</code></td>
</tr>
<tr><th> Wheelmap: </th>
<td><img src='/wheelmap/a/2323004600.svg' alt='' /></td>
<td><code>http://img.shields.io/wheelmap/a/2323004600.svg</code></td>
</tr>
</tbody></table>
<h3> Build </h3>
<table><tbody>
<tr><th> Travis: </th>
@ -174,8 +111,8 @@ I made the GitHub Badge Service.
<td><img src='/teamcity/http/teamcity.jetbrains.com/s/bt345.svg' alt=''/></td>
<td><code>http://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/bt345.svg</code></td>
</tr>
<tr><th> TeamCity (full build status): </th>
<td><img src='/teamcity/http/teamcity.jetbrains.com/e/bt345.svg' alt=''/></td>
<tr><th> (full build status): </th>
<td>&nbsp;</td>
<td><code>http://img.shields.io/teamcity/http/teamcity.jetbrains.com/e/bt345.svg</code></td>
</tr>
<tr><th> AppVeyor: </th>
@ -386,8 +323,72 @@ I made the GitHub Badge Service.
</tr>
</tbody></table>
<h3> Issues </h3>
<h3> Miscellaneous </h3>
<table><tbody>
<tr><th> Gratipay: </th>
<td><img src='/gratipay/JSFiddle.svg' alt=''/></td>
<td><code>http://img.shields.io/gratipay/JSFiddle.svg</code></td>
</tr>
<tr><th> Bountysource: </th>
<td><img src='/bountysource/team/mozilla-core/activity.svg' alt=''/></td>
<td><code>http://img.shields.io/bountysource/team/mozilla-core/activity.svg</code></td>
</tr>
<tr><th> Code Climate: </th>
<td><img src='/codeclimate/github/kabisaict/flow.svg' alt=''/></td>
<td><code>http://img.shields.io/codeclimate/github/kabisaict/flow.svg</code></td>
</tr>
<tr><th> Code Climate: </th>
<td><img src='/codeclimate/coverage/github/triAGENS/ashikawa-core.svg' alt=''/></td>
<td><code>http://img.shields.io/codeclimate/coverage/github/triAGENS/ashikawa-core.svg</code></td>
</tr>
<tr><th> Gemnasium: </th>
<td><img src='/gemnasium/mathiasbynens/he.svg' alt=''/></td>
<td><code>http://img.shields.io/gemnasium/mathiasbynens/he.svg</code></td>
</tr>
<tr><th> David: </th>
<td><img src='/david/strongloop/express.svg' alt=''/></td>
<td><code>http://img.shields.io/david/strongloop/express.svg</code></td>
</tr>
<tr><th> David: </th>
<td><img src='/david/dev/strongloop/express.svg' alt=''/></td>
<td><code>http://img.shields.io/david/dev/strongloop/express.svg</code></td>
</tr>
<tr><th> David: </th>
<td><img src='/david/peer/webcomponents/generator-element.svg' alt=''/></td>
<td><code>http://img.shields.io/david/peer/webcomponents/generator-element.svg</code></td>
</tr>
<tr><th> Hackage-Deps: </th>
<td><img src='/hackage-deps/v/lens.svg' alt=''/></td>
<td><code>http://img.shields.io/hackage-deps/v/lens.svg</code></td>
</tr>
<tr><th> Packagist: </th>
<td><img src='/packagist/l/doctrine/orm.svg' alt=''/></td>
<td><code>http://img.shields.io/packagist/l/doctrine/orm.svg</code></td>
</tr>
<tr><th> npm: </th>
<td><img src='/npm/l/express.svg' alt=''/></td>
<td><code>http://img.shields.io/npm/l/express.svg</code></td>
</tr>
<tr><th> PyPI: </th>
<td><img src='/pypi/l/Django.svg' alt=''/></td>
<td><code>http://img.shields.io/pypi/l/Django.svg</code></td>
</tr>
<tr><th> Hex.pm: </th>
<td><img src='/hexpm/l/plug.svg' alt=''/></td>
<td><code>http://img.shields.io/hexpm/l/plug.svg</code></td>
</tr>
<tr><th> CocoaPods: </th>
<td><img src='/cocoapods/l/AFNetworking.svg' alt='' /></td>
<td><code>http://img.shields.io/cocoapods/l/AFNetworking.svg</code></td>
</tr>
<tr><th> CocoaPods: </th>
<td><img src='/cocoapods/p/AFNetworking.svg' alt='' /></td>
<td><code>http://img.shields.io/cocoapods/p/AFNetworking.svg</code></td>
</tr>
<tr><th> Wheelmap: </th>
<td><img src='/wheelmap/a/2323004600.svg' alt='' /></td>
<td><code>http://img.shields.io/wheelmap/a/2323004600.svg</code></td>
</tr>
<tr><th> GitHub: </th>
<td><img src='/github/issues/badges/shields.svg' alt=''/></td>
<td><code>http://img.shields.io/github/issues/badges/shields.svg</code></td>