Merge remote-tracking branch 'jpellis/aur'

This commit is contained in:
Thaddee Tyl 2016-04-06 01:13:05 +02:00
commit 6fb5bd2d01
2 changed files with 53 additions and 0 deletions

View File

@ -4957,7 +4957,49 @@ cache(function(data, match, sendBadge, request) {
badgeData.colorscheme = null;
badgeData.colorB = '#' + (color || '78bdf2');
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);
}
});
}));
// Arch user repository (AUR) integration.
camp.route(/^\/aur\/(version|votes|license)\/(.*)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var info = match[1];
var pkg = match[2];
var format = match[3];
var apiUrl = 'https://aur.archlinux.org/rpc.php?type=info&arg=' + pkg;
var badgeData = getBadgeData('AUR', data);
request(apiUrl, function(err, res, buffer) {
if (err != null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
}
try {
var data = JSON.parse(buffer).results;
if (info === 'version') {
var vdata = versionColor(data.Version);
badgeData.text[1] = vdata.version;
if (data.OutOfDate === null) {
badgeData.colorscheme = 'blue';
} else {
badgeData.colorscheme = 'orange';
}
} else if (info === 'votes') {
var votes = data.NumVotes;
badgeData.text[0] = "votes";
badgeData.text[1] = votes;
badgeData.colorscheme = floorCountColor(votes, 2, 20, 60);
} else if (info === 'license') {
var license = data.License;
badgeData.text[0] = "license";
badgeData.text[1] = license;
badgeData.colorscheme = 'blue';
}
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);

View File

@ -514,6 +514,10 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable
<td><img src='/dub/v/vibe-d.svg' alt=''/></td>
<td><code>https://img.shields.io/dub/v/vibe-d.svg</code></td>
</tr>
<tr><th data-keywords='aur'> AUR: </th>
<td><img src='/aur/version/yaourt.svg' alt=''/></td>
<td><code>https://img.shields.io/aur/version/yaourt.svg</code></td>
</tr>
</tbody></table>
<h3 id="social"> Social </h3>
@ -542,6 +546,10 @@ Pixel-perfect &nbsp; Retina-ready &nbsp; Fast &nbsp; Consistent &nbsp; Hackable
<td><img src='/twitter/follow/shields_io.svg?style=social' alt=''/></td>
<td><code>https://img.shields.io/twitter/follow/shields_io.svg?style=social</code></td>
</tr>
<tr><th data-keywords='aur'> AUR: </th>
<td><img src='/aur/votes/yaourt.svg' alt=''/></td>
<td><code>https://img.shields.io/aur/votes/yaourt.svg</code></td>
</tr>
</tbody></table>
<h3 id="miscellaneous"> Miscellaneous </h3>
@ -749,6 +757,9 @@ Pixel-perfect &nbsp; Retina-ready &nbsp; Fast &nbsp; Consistent &nbsp; Hackable
<tr><th> Maintenance: </th>
<td><img src='/maintenance/yes/2016.svg' alt=''/></td>
<td><code>https://img.shields.io/maintenance/yes/2016.svg</code></td>
<tr><th data-keywords='aur'> AUR: </th>
<td><img src='/aur/license/yaourt.svg' alt=''/></td>
<td><code>https://img.shields.io/aur/license/yaourt.svg</code></td>
</tr>
<tr><th> Waffle.io: </th>
<td><img src='/waffle/label/evancohen/smart-mirror/in%20progress.svg' alt=''/></td>