standardize label on [cpan] license badge (#2173)

This commit is contained in:
Jowita Mielnicka
2018-10-14 20:31:47 +02:00
committed by chris48s
parent 89ff0687af
commit fb6e91c3b2
2 changed files with 16 additions and 0 deletions

View File

@@ -6,6 +6,9 @@ const { addv: versionText } = require('../../lib/text-formatters')
const { version: versionColor } = require('../../lib/color-formatters')
module.exports = class Cpan extends LegacyService {
static get url() {
return { base: 'cpan' }
}
static registerLegacyRouteHandler({ camp, cache }) {
camp.route(
/^\/cpan\/([^/]+)\/([^/]+)\.(svg|png|gif|jpg|json)$/,
@@ -31,6 +34,7 @@ module.exports = class Cpan extends LegacyService {
} else if (info === 'l') {
const license = data.license[0]
badgeData.text[1] = license
badgeData.text[0] = 'license'
badgeData.colorscheme = 'blue'
}
sendBadge(format, badgeData)

View File

@@ -0,0 +1,12 @@
'use strict'
const createServiceTester = require('../create-service-tester')
const t = createServiceTester()
module.exports = t
t.create('license')
.get('/l/Config-Augeas.json')
.expectJSON({
name: 'license',
value: 'lgpl_2_1',
})