Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow committed Jan 12, 2019
1 parent ae31316 commit 24c1178
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 25 deletions.
2 changes: 1 addition & 1 deletion services/cocoapods/cocoapods.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = class CocoapodsVersionPlatformLicense extends LegacyService {
const apiUrl = `https://trunk.cocoapods.org/api/v1/pods/${spec}/specs/latest`
const typeToLabel = { v: 'pod', p: 'platform', l: 'license' }
const badgeData = getBadgeData(typeToLabel[type], data)
badgeData.colorscheme = null
badgeData.colorscheme = undefined
request(apiUrl, (err, res, buffer) => {
if (checkErrorResponse(badgeData, err, res)) {
sendBadge(format, badgeData)
Expand Down
12 changes: 1 addition & 11 deletions services/docker/docker-stars.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ t.create('docker stars (valid, library)')
Joi.object().keys({
name: 'docker stars',
value: isMetric,
colorB: `#${dockerBlue}`,
})
)

t.create('docker stars (override colorB)')
.get('/_/ubuntu.json?colorB=fedcba&style=_shields_test')
.expectJSONTypes(
Joi.object().keys({
name: 'docker stars',
value: isMetric,
colorB: '#fedcba',
color: `#${dockerBlue}`,
})
)

Expand Down
2 changes: 1 addition & 1 deletion services/github/github-followers.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = class GithubFollowers extends LegacyService {
}
try {
badgeData.text[1] = JSON.parse(buffer).followers
badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = '#4183C4'
sendBadge(format, badgeData)
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion services/github/github-forks.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = class GithubForks extends LegacyService {
const data = JSON.parse(buffer)
const forks = data.forks_count
badgeData.text[1] = forks
badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = '#4183C4'
sendBadge(format, badgeData)
} catch (e) {
Expand Down
6 changes: 3 additions & 3 deletions services/github/github-issue-detail.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = class GithubIssueDetail extends LegacyService {
switch (which) {
case 's': {
const state = (badgeData.text[1] = parsedData.state)
badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = makeColorB(
githubStateColor(state),
queryParams
Expand All @@ -136,7 +136,7 @@ module.exports = class GithubIssueDetail extends LegacyService {
.map(i => i.name)
.join(' | ')
if (parsedData.labels.length === 1) {
badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = makeColorB(
parsedData.labels[0].color,
queryParams
Expand All @@ -146,7 +146,7 @@ module.exports = class GithubIssueDetail extends LegacyService {
case 'comments': {
badgeData.text[0] = getLabel('comments', queryParams)
const comments = (badgeData.text[1] = parsedData.comments)
badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = makeColorB(
githubCommentsColor(comments),
queryParams
Expand Down
2 changes: 1 addition & 1 deletion services/microbadger/microbadger.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ module.exports = class MicroBadger extends LegacyService {
} else if (type === 'layers') {
badgeData.text[1] = image.LayerCount
}
badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = 'blue'
sendBadge(format, badgeData)
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions services/twitter/twitter.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TwitterUrl extends LegacyService {
]
}
badgeData.text[1] = ''
badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = data.colorB || '#55ACEE'
sendBadge(format, badgeData)
})
Expand Down Expand Up @@ -99,7 +99,7 @@ class TwitterFollow extends LegacyService {
}
const badgeData = getBadgeData(`follow @${user}`, data)

badgeData.colorscheme = null
badgeData.colorscheme = undefined
badgeData.colorB = '#55ACEE'
if (badgeData.template === 'social') {
badgeData.logo = getLogo('twitter', data)
Expand Down
5 changes: 2 additions & 3 deletions services/waffle/waffle.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const LegacyService = require('../legacy-service')
const {
makeBadgeData: getBadgeData,
makeLabel: getLabel,
makeColorB,
} = require('../../lib/badge-data')
const { checkErrorResponse } = require('../../lib/error-helper')

Expand Down Expand Up @@ -80,8 +79,8 @@ module.exports = class Waffle extends LegacyService {
}
badgeData.text[0] = getLabel(ghLabel, data)
badgeData.text[1] = `${count}`
badgeData.colorscheme = null
badgeData.colorB = makeColorB(color, data)
badgeData.colorscheme = undefined
badgeData.colorB = data.colorB || color
sendBadge(format, badgeData)
} catch (e) {
badgeData.text[1] = 'invalid'
Expand Down
4 changes: 2 additions & 2 deletions services/waffle/waffle.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ t.create(
.expectJSON({
name: 'bug',
value: '5',
colorB: '#fbca04',
color: '#fbca04',
})

t.create('label should be `Mybug` & value should be formatted. e.g: Mybug|25')
Expand Down Expand Up @@ -69,7 +69,7 @@ t.create('label (label not found)')
.expectJSON({
name: 'not-a-real-label',
value: '0',
colorB: '#78bdf2',
color: '#78bdf2',
})

t.create('label (empty response)')
Expand Down

0 comments on commit 24c1178

Please sign in to comment.