Added support for Coverity On Demand badges.
This commit is contained in:
parent
65cb0b7719
commit
9e2d69e7ef
27
server.js
27
server.js
|
@ -684,6 +684,33 @@ cache(function(data, match, sendBadge, request) {
|
|||
});
|
||||
}));
|
||||
|
||||
// Coverity Code Advisor On Demand integration
|
||||
camp.route(/^\/coverity\/ondemand\/(.+)\/(.+)\.(svg|png|gif|jpg|json)$/,
|
||||
cache(function(data, match, sendBadge, request) {
|
||||
var badgeType = match[1]; // streams or jobs
|
||||
var badgeTypeId = match[2]; // streamId or jobId
|
||||
var format = match[3];
|
||||
var url = 'https://api.ondemand.coverity.com/' + badgeType + '/' + badgeTypeId + '/badge';
|
||||
// var url = 'https://api-stage01.caas.coverity.com/' + badgeType + '/' + badgeTypeId + '/badge';
|
||||
// var url = 'http://localhost:21020/' + badgeType + '/' + badgeTypeId + '/badge';
|
||||
console.log(url)
|
||||
var badgeData = getBadgeData('coverity', data);
|
||||
request(url, function(err, res, buffer) {
|
||||
if (err != null) {
|
||||
badgeData.text[1] = 'inaccessible';
|
||||
sendBadge(format, badgeData);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
badgeData = JSON.parse(buffer);
|
||||
sendBadge(format, badgeData);
|
||||
} catch(e) {
|
||||
badgeData.text[1] = 'invalid';
|
||||
sendBadge(format, badgeData);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
// Gratipay integration.
|
||||
camp.route(/^\/(gittip|gratipay)\/(.*)\.(svg|png|gif|jpg|json)$/,
|
||||
cache(function(data, match, sendBadge, request) {
|
||||
|
|
4
try.html
4
try.html
|
@ -172,6 +172,10 @@ Pixel-perfect Retina-ready Fast Consistent Hackable
|
|||
<td><img src='/coverity/scan/3997.svg' alt=''/></td>
|
||||
<td><code>https://img.shields.io/coverity/scan/3997.svg</code></td>
|
||||
</tr>
|
||||
<tr><th> Coverity Code Advisor On Demand: </th>
|
||||
<td><img src='/coverity/ondemand/streams/1234.svg' alt=''/></td>
|
||||
<td><code>https://img.shields.io/coverity/ondemand/streams/1234.svg</code></td>
|
||||
</tr>
|
||||
<tr><th> HHVM: </th>
|
||||
<td><img src='/hhvm/symfony/symfony.svg' alt=''/></td>
|
||||
<td><code>https://img.shields.io/hhvm/symfony/symfony.svg</code></td>
|
||||
|
|
Loading…
Reference in New Issue
Block a user