diff --git a/server.js b/server.js index 6d60721..767285b 100644 --- a/server.js +++ b/server.js @@ -240,11 +240,15 @@ function(data, match, end, ask) { }); // Coveralls integration. -camp.route(/^\/coveralls\/(.*)\.(svg|png|gif|jpg)$/, +camp.route(/^\/coveralls\/([^\/]+\/[^\/]+)(?:\/(.+))?\.(svg|png|gif|jpg)$/, function(data, match, end, ask) { var userRepo = match[1]; // eg, `jekyll/jekyll`. - var format = match[2]; - var apiUrl = 'https://coveralls.io/repos/' + userRepo + '/badge.png?branch=master'; + var branch = match[2]; + var format = match[3]; + var apiUrl = 'https://coveralls.io/repos/' + userRepo + '/badge.png'; + if (branch) { + apiUrl += '?branch=' + branch; + } var badgeData = {text:['coverage', 'n/a'], colorscheme:'lightgrey'}; https.get(apiUrl, function(res) { // We should get a 302. Look inside the Location header. diff --git a/web/index.html b/web/index.html index 2583a9a..f76601d 100644 --- a/web/index.html +++ b/web/index.html @@ -98,10 +98,13 @@ Use an underscore _ if you want a space. Or, you know, use a space. Gittip http://b.adge.me/gittip/JSFiddle.svg - Coveralls: + Coveralls (repo): Coveralls http://b.adge.me/coveralls/jekyll/jekyll.svg + Coveralls (branch): + Coveralls + http://b.adge.me/coveralls/jekyll/jekyll/master.svg npm: npm