Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert a bunch of exampleUrls and formats [ansible bitrise circleci clojars codacy codeclimate codecov depfu discord] #2633

Merged
merged 7 commits into from
Jan 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions services/ansible/ansible.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ class AnsibleGalaxyRoleDownloads extends AnsibleGalaxyRole {
static get examples() {
return [
{
title: `Ansible Role`,
pattern: ':roleId',
exampleUrl: '3078',
title: 'Ansible Role',
namedParams: { roleId: '3078' },
staticExample: this.render({ downloads: 76 }),
},
]
Expand Down Expand Up @@ -88,17 +87,15 @@ class AnsibleGalaxyRoleName extends AnsibleGalaxyRole {
static get route() {
return {
base: 'ansible/role',
format: '(.+)',
capture: ['roleId'],
pattern: ':roleId',
}
}

static get examples() {
return [
{
title: `Ansible Role`,
pattern: ':roleId',
exampleUrl: '3078',
title: 'Ansible Role',
namedParams: { roleId: '3078' },
staticExample: this.render({
name: 'ansible-roles.sublimetext3_packagecontrol',
}),
Expand Down
11 changes: 8 additions & 3 deletions services/bitrise/bitrise.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ module.exports = class Bitrise extends LegacyService {
return [
{
title: 'Bitrise',
previewUrl: 'cde737473028420d/master?token=GCIdEzacE4GW32jLVrZb7A',
pattern: ':app-id/:branch?token=:app-status-badge-token',
exampleUrl: 'cde737473028420d/master?token=GCIdEzacE4GW32jLVrZb7A',
pattern: ':appId/:branch',
namedParams: { appId: 'cde737473028420d', branch: 'master' },
queryParams: { token: 'GCIdEzacE4GW32jLVrZb7A' },
calebcartwright marked this conversation as resolved.
Show resolved Hide resolved
staticExample: {
label: 'bitrise',
message: 'success',
color: 'brightgreen',
},
},
]
}
Expand Down
7 changes: 2 additions & 5 deletions services/cdnjs/cdnjs.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,15 @@ module.exports = class Cdnjs extends BaseJsonService {
static get route() {
return {
base: 'cdnjs/v',
format: '(.+)',
capture: ['library'],
pattern: ':library',
}
}

static get examples() {
return [
{
pattern: ':library',
exampleUrl: 'jquery',
namedParams: { library: 'jquery' },
staticExample: this.render({ version: '1.5.2' }),
keywords: ['cdn', 'cdnjs'],
},
]
}
Expand Down
22 changes: 18 additions & 4 deletions services/circleci/circleci.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,35 @@ module.exports = class CircleCi extends BaseJsonService {
return [
{
title: 'CircleCI (all branches)',
exampleUrl: 'project/github/RedSparr0w/node-csgo-parser',
pattern: 'project/:vcsType/:owner/:repo',
namedParams: {
vcsType: 'github',
owner: 'RedSparr0w',
repo: 'node-csgo-parser',
},
staticExample: this.render({ status: 'success' }),
},
{
title: 'CircleCI branch',
exampleUrl: 'project/github/RedSparr0w/node-csgo-parser/master',
pattern: 'project/:vcsType/:owner/:repo/:branch',
namedParams: {
vcsType: 'github',
owner: 'RedSparr0w',
repo: 'node-csgo-parser',
branch: 'master',
},
staticExample: this.render({ status: 'success' }),
},
{
title: 'CircleCI token',
pattern: 'token/:token/project/:vcsType/:owner/:repo/:branch',
exampleUrl:
'token/b90b5c49e59a4c67ba3a92f7992587ac7a0408c2/project/github/RedSparr0w/node-csgo-parser/master',
namedParams: {
token: 'b90b5c49e59a4c67ba3a92f7992587ac7a0408c2',
vcsType: 'github',
owner: 'RedSparr0w',
repo: 'node-csgo-parser',
branch: 'master',
},
staticExample: this.render({ status: 'success' }),
documentation,
},
Expand Down
6 changes: 2 additions & 4 deletions services/clojars/clojars-downloads.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ module.exports = class Clojars extends BaseJsonService {
static get route() {
return {
base: 'clojars/dt',
format: '(.+)',
capture: ['clojar'],
pattern: ':clojar+',
}
}

static get examples() {
return [
{
exampleUrl: 'prismic',
pattern: ':package',
namedParams: { clojar: 'prismic' },
staticExample: this.render({ downloads: 117 }),
},
]
Expand Down
6 changes: 2 additions & 4 deletions services/clojars/clojars-version.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@ module.exports = class Clojars extends BaseJsonService {
static get route() {
return {
base: 'clojars/v',
format: '(.+)',
capture: ['clojar'],
pattern: ':clojar+',
}
}

static get examples() {
return [
{
exampleUrl: 'prismic',
pattern: ':package',
namedParams: { clojar: 'prismic' },
staticExample: this.render({ clojar: 'clojar', version: '1.2' }),
},
]
Expand Down
7 changes: 5 additions & 2 deletions services/codacy/codacy-coverage.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ module.exports = class CodacyCoverage extends BaseSvgScrapingService {
{
title: 'Codacy coverage',
pattern: ':projectId',
namedParams: { projectId: '59d607d0e311408885e418004068ea58' },
staticExample: this.render({ percentage: 90 }),
exampleUrl: '59d607d0e311408885e418004068ea58',
},
{
title: 'Codacy branch coverage',
pattern: ':projectId/:branch',
namedParams: {
projectId: '59d607d0e311408885e418004068ea58',
branch: 'master',
},
staticExample: this.render({ percentage: 90 }),
exampleUrl: '59d607d0e311408885e418004068ea58/master',
},
]
}
Expand Down
7 changes: 5 additions & 2 deletions services/codacy/codacy-grade.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ module.exports = class CodacyGrade extends BaseSvgScrapingService {
{
title: 'Codacy grade',
pattern: ':projectId',
namedParams: { projectId: 'e27821fb6289410b8f58338c7e0bc686' },
staticExample: this.render({ grade: 'A' }),
exampleUrl: 'e27821fb6289410b8f58338c7e0bc686',
},
{
title: 'Codacy branch grade',
pattern: ':projectId/:branch',
namedParams: {
projectId: 'e27821fb6289410b8f58338c7e0bc686',
branch: 'master',
},
staticExample: this.render({ grade: 'A' }),
exampleUrl: 'e27821fb6289410b8f58338c7e0bc686/master',
},
]
}
Expand Down
12 changes: 6 additions & 6 deletions services/codeclimate/codeclimate.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,20 @@ module.exports = class Codeclimate extends LegacyService {
return [
{
title: 'Code Climate issues',
exampleUrl: 'issues/twbs/bootstrap',
pattern: 'issues/:userRepo',
namedParams: { userRepo: 'twbs/bootstrap' },
staticExample: { label: 'issues', message: '89', color: 'red' },
},
{
title: 'Code Climate maintainability',
exampleUrl: 'maintainability/angular/angular.js',
pattern: 'maintainability/:userRepo',
namedParams: { userRepo: 'angular/angular.js' },
staticExample: { label: 'maintainability', message: 'F', color: 'red' },
},
{
title: 'Code Climate maintainability (percentage)',
exampleUrl: 'maintainability-percentage/angular/angular.js',
pattern: 'maintainability-percentage/:userRepo',
namedParams: { userRepo: 'angular/angular.js' },
staticExample: {
label: 'maintainability',
message: '4.6%',
Expand All @@ -177,8 +177,8 @@ module.exports = class Codeclimate extends LegacyService {
},
{
title: 'Code Climate coverage',
exampleUrl: 'coverage/jekyll/jekyll',
pattern: 'coverage/:userRepo',
namedParams: { userRepo: 'jekyll/jekyll' },
staticExample: {
label: 'coverage',
message: '95%',
Expand All @@ -187,8 +187,8 @@ module.exports = class Codeclimate extends LegacyService {
},
{
title: 'Code Climate coverage (letter)',
exampleUrl: 'coverage-letter/jekyll/jekyll',
pattern: 'coverage-letter/:userRepo',
namedParams: { userRepo: 'jekyll/jekyll' },
staticExample: {
label: 'coverage',
message: 'A',
Expand All @@ -197,8 +197,8 @@ module.exports = class Codeclimate extends LegacyService {
},
{
title: 'Code Climate technical debt',
exampleUrl: 'tech-debt/jekyll/jekyll',
pattern: 'tech-debt/:userRepo',
namedParams: { userRepo: 'jekyll/jekyll' },
staticExample: {
label: 'technical debt',
message: '3%',
Expand Down
28 changes: 23 additions & 5 deletions services/codecov/codecov.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,35 @@ module.exports = class Codecov extends LegacyService {
return [
{
title: 'Codecov',
previewUrl: 'github/codecov/example-python',
pattern: ':vcsName/:user/:repo',
namedParams: {
vcsName: 'github',
user: 'codecov',
repo: 'example-python',
},
staticPreview: { label: 'coverage', message: '90%', color: 'green' },
},
{
title: 'Codecov branch',
previewUrl: 'github/codecov/example-python/master',
pattern: ':vcsName/:user/:repo/:branch',
namedParams: {
vcsName: 'github',
user: 'codecov',
repo: 'example-python',
branch: 'master',
},
staticPreview: { label: 'coverage', message: '90%', color: 'green' },
},
{
title: 'Codecov private',
previewUrl: 'github/codecov/example-python',
pattern: 'token/:token/github/codecov/example-python',
exampleUrl: 'token/My0A8VL917/github/codecov/example-python',
pattern: 'token/:token/:vcsName/:user/:repo',
namedParams: {
token: 'My0A8VL917',
vcsName: 'github',
user: 'codecov',
repo: 'example-python',
paulmelnikow marked this conversation as resolved.
Show resolved Hide resolved
},
staticPreview: { label: 'coverage', message: '90%', color: 'green' },
},
]
}
Expand Down
12 changes: 4 additions & 8 deletions services/ctan/ctan.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ class CtanLicense extends BaseCtanService {
static get route() {
return {
base: 'ctan/l',
format: '(.+)',
capture: ['library'],
pattern: ':library',
}
}

static get examples() {
return [
{
title: 'CTAN',
exampleUrl: 'novel',
pattern: ':library',
namedParams: { library: 'novel' },
staticExample: this.render({ licenses: ['ppl1.3c', 'ofl'] }),
keywords: ['tex'],
},
Expand All @@ -85,17 +83,15 @@ class CtanVersion extends BaseCtanService {
static get route() {
return {
base: 'ctan/v',
format: '(.+)',
capture: ['library'],
pattern: ':library',
}
}

static get examples() {
return [
{
title: 'CTAN',
exampleUrl: 'tex',
pattern: ':library',
namedParams: { library: 'tex' },
staticExample: this.render({ version: '3.14159265' }),
keywords: ['tex'],
},
Expand Down
14 changes: 6 additions & 8 deletions services/depfu/depfu.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const depfuSchema = Joi.object({
}).required()

module.exports = class Depfu extends BaseJsonService {
async fetch({ userRepo }) {
const url = `https://depfu.com/github/shields/${userRepo}`
async fetch({ user, repo }) {
const url = `https://depfu.com/github/shields/${user}/${repo}`
return this._requestJson({ url, schema: depfuSchema })
}

Expand All @@ -21,8 +21,8 @@ module.exports = class Depfu extends BaseJsonService {
}
}

async handle({ userRepo }) {
const { text, colorscheme } = await this.fetch({ userRepo })
async handle({ user, repo }) {
const { text, colorscheme } = await this.fetch({ user, repo })
return this.constructor.render({ text, colorscheme })
}

Expand All @@ -37,17 +37,15 @@ module.exports = class Depfu extends BaseJsonService {
static get route() {
return {
base: 'depfu',
format: '(.+)',
capture: ['userRepo'],
pattern: ':user/:repo',
}
}

static get examples() {
return [
{
title: 'Depfu',
exampleUrl: 'depfu/example-ruby',
pattern: ':user/:repo',
namedParams: { user: 'depfu', repo: 'example-ruby' },
staticExample: this.render({
text: 'recent',
colorscheme: 'brightgreen',
Expand Down
6 changes: 2 additions & 4 deletions services/discord/discord.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,15 @@ module.exports = class Discord extends BaseJsonService {
static get route() {
return {
base: 'discord',
format: '([^/]+)',
capture: ['serverId'],
pattern: ':serverId',
}
}

static get examples() {
return [
{
title: 'Discord',
exampleUrl: '102860784329052160',
pattern: ':serverId',
namedParams: { serverId: '102860784329052160' },
staticExample: this.render({ members: 23 }),
},
]
Expand Down