Added PyPI license support

This commit is contained in:
Chris Reeves 2014-07-16 11:59:22 +01:00
parent 0baa320968
commit 358c690b10
2 changed files with 16 additions and 0 deletions

View File

@ -127,6 +127,11 @@ I made the GitHub Badge Service.
<td><img src='//img.shields.io/cocoapods/p/AFNetworking.svg' alt='' /></td>
<td><code>http://img.shields.io/cocoapods/p/AFNetworking.svg</code></td>
</tr>
<tr><th> PyPI (License): </th>
<td><img src='//img.shields.io/pypi/l/Django.svg' alt=''/></td>
<td><code>http://img.shields.io/pypi/l/Django.svg</code></td>
</tr>
</tbody></table>
<h3> Build </h3>
<table><tbody>

View File

@ -684,6 +684,17 @@ cache(function(data, match, sendBadge) {
badgeData.colorscheme = 'blue';
}
sendBadge(format, badgeData);
} else if (info == 'l') {
var license = data.info.license;
badgeData.text[0] = 'license';
if(license == null || license == 'UNKNOWN') {
badgeData.text[1] = 'Unknown';
badgeData.colorscheme = 'red';
} else {
badgeData.text[1] = license;
badgeData.colorscheme = 'blue';
}
sendBadge(format, badgeData);
}
} catch(e) {
badgeData.text[1] = 'invalid';