Merge remote-tracking branch 'aspyker/master'

Fixes #741.
This commit is contained in:
Thaddee Tyl 2017-01-11 23:55:35 +01:00
commit 21ae49ad85
4 changed files with 54 additions and 1 deletions

View File

@ -126,7 +126,7 @@ heroku open
You can build and run the server locally using Docker. First build an image:
```console
$ docker build -t shields ./
$ docker build -t shields .
Sending build context to Docker daemon 3.923 MB
Step 0 : FROM node:6.4.0-onbuild

View File

@ -973,6 +973,10 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable
<td><img src='https://img.shields.io/librariesio/github/phoenixframework/phoenix.svg?maxAge=2592000' alt=''/></td>
<td><code>https://img.shields.io/librariesio/github/phoenixframework/phoenix.svg</code></td>
</tr>
<tr><th> NetflixOSS Lifecycle: </th>
<td><img src='https://img.shields.io/osslifecycle/Netflix/osstracker.svg?maxAge=2592000' alt=''/></td>
<td><code>https://img.shields.io/osslifecycle/Netflix/osstracker.svg</code></td>
</tr>
</tbody></table>
<h2 id="your-badge"> Your Badge </h2>

View File

@ -453,6 +453,51 @@ cache(function(data, match, sendBadge, request) {
});
}));
// NetflixOSS metadata integration
camp.route(/^\/osslifecycle?\/([^\/]+\/[^\/]+)(?:\/(.+))?\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var orgOrUserAndRepo = match[1];
var branch = match[2];
var format = match[3];
var url = 'https://raw.githubusercontent.com/' + orgOrUserAndRepo;
if (branch != null) {
url += "/" + branch + "/OSSMETADATA"
}
else {
url += "/master/OSSMETADATA";
}
var options = {
method: 'GET',
uri: url
};
var badgeData = getBadgeData('OSS Lifecycle', data);
request(options, function(err, res, body) {
if (err != null) {
console.error('NetflixOSS error: ' + err.stack);
if (res) { console.error(''+res); }
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);
return;
}
try {
var matchStatus = body.match(/osslifecycle\=([a-z]+)/im);
if (matchStatus === null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
} else {
badgeData.text[1] = matchStatus[1];
sendBadge(format, badgeData);
return;
}
} catch(e) {
console.log(e);
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
}
});
}));
// Shippable integration
camp.route(/^\/shippable\/([^\/]+)(?:\/(.+))?\.(svg|png|gif|jpg|json)$/,
cache(function (data, match, sendBadge, request) {

View File

@ -972,6 +972,10 @@ Pixel-perfect &nbsp; Retina-ready &nbsp; Fast &nbsp; Consistent &nbsp; Hackable
<td><img src='/librariesio/github/phoenixframework/phoenix.svg' alt=''/></td>
<td><code>https://img.shields.io/librariesio/github/phoenixframework/phoenix.svg</code></td>
</tr>
<tr><th> NetflixOSS Lifecycle: </th>
<td><img src='/osslifecycle/Netflix/osstracker.svg' alt=''/></td>
<td><code>https://img.shields.io/osslifecycle/Netflix/osstracker.svg</code></td>
</tr>
</tbody></table>
<h2 id="your-badge"> Your Badge </h2>