Added official Libscore badge

This commit is contained in:
Thomas Davis 2014-12-21 09:55:57 +10:00 committed by Thaddee Tyl
parent abbd893e2e
commit dbffa3eb19
2 changed files with 30 additions and 0 deletions

View File

@ -510,6 +510,32 @@ cache(function(data, match, sendBadge, request) {
});
}));
// Libscore integration.
camp.route(/^\/libscore\/s\/(.*)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var library = match[1]; // eg, `jQuery`.
var format = match[2];
var apiUrl = 'http://api.libscore.com/v1/libraries/' + library;
var badgeData = getBadgeData('libscore', data);
request(apiUrl, function dealWithData(err, res, buffer) {
if (err != null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
}
try {
var data = JSON.parse(buffer);
badgeData.text[1] = data.count;
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);
}
});
}));
// Bountysource integration.
camp.route(/^\/bountysource\/team\/([^\/]+)\/([^\/]+)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {

View File

@ -439,6 +439,10 @@ When that is implemented, change the placeholder to
<td><img src='/codacy/e27821fb6289410b8f58338c7e0bc686.svg' alt=''/></td>
<td><code>https://img.shields.io/codacy/e27821fb6289410b8f58338c7e0bc686.svg</code></td>
</tr>
<tr><th> Libscore: </th>
<td><img src='/libscore/s/jQuery.svg' alt=''/></td>
<td><code>https://img.shields.io/libscore/c/jQuery.svg</code></td>
</tr>
</tbody></table>
<h2> Your Badge </h2>