Bower license

Fixes #494
This commit is contained in:
Thaddee Tyl 2015-07-21 09:29:06 +02:00
parent fd5e1bb24c
commit 09982436d5
3 changed files with 32 additions and 0 deletions

View File

@ -547,6 +547,10 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable
<td><img src='https://img.shields.io/apm/l/vim-mode.svg' alt=''/></td>
<td><code>https://img.shields.io/apm/l/vim-mode.svg</code></td>
</tr>
<tr><th> Bower: </th>
<td><img src='https://img.shields.io/bower/l/bootstrap.svg' alt='' /></td>
<td><code>https://img.shields.io/bower/l/bootstrap.svg</code></td>
</tr>
<tr><th data-keywords='python'> PyPI: </th>
<td><img src='https://img.shields.io/pypi/l/Django.svg' alt=''/></td>
<td><code>https://img.shields.io/pypi/l/Django.svg</code></td>

View File

@ -3228,6 +3228,30 @@ cache(function(data, match, sendBadge, request) {
});
}));
// Bower license integration.
camp.route(/^\/bower\/l\/(.*)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var repo = match[1]; // eg, `bootstrap`.
var format = match[2];
var badgeData = getBadgeData('bower', data);
var bower = require('bower');
bower.commands.info(repo, 'license')
.on('error', function() {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
})
.on('end', function(license) {
try {
badgeData.text[1] = license;
badgeData.colorscheme = 'blue';
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'void';
sendBadge(format, badgeData);
}
});
}));
// Wheelmap integration.
camp.route(/^\/wheelmap\/a\/(.*)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {

View File

@ -546,6 +546,10 @@ Pixel-perfect &nbsp; Retina-ready &nbsp; Fast &nbsp; Consistent &nbsp; Hackable
<td><img src='/apm/l/vim-mode.svg' alt=''/></td>
<td><code>https://img.shields.io/apm/l/vim-mode.svg</code></td>
</tr>
<tr><th> Bower: </th>
<td><img src='/bower/l/bootstrap.svg' alt='' /></td>
<td><code>https://img.shields.io/bower/l/bootstrap.svg</code></td>
</tr>
<tr><th data-keywords='python'> PyPI: </th>
<td><img src='/pypi/l/Django.svg' alt=''/></td>
<td><code>https://img.shields.io/pypi/l/Django.svg</code></td>