Update more exampleUrls; style tweaks (#2639)

This commit is contained in:
Paul Melnikow
2019-01-06 08:18:19 -05:00
committed by GitHub
parent 2e1ce1a4ca
commit 83044ce325
32 changed files with 211 additions and 138 deletions

View File

@@ -11,14 +11,14 @@ module.exports = class AppVeyorCi extends AppVeyorBase {
return [
{
title: 'AppVeyor',
exampleUrl: 'gruntjs/grunt',
pattern: ':user/:repo',
namedParams: { user: 'gruntjs', repo: 'grunt' },
staticExample: this.render({ status: 'success' }),
},
{
title: 'AppVeyor branch',
exampleUrl: 'gruntjs/grunt/master',
pattern: ':user/:repo/:branch',
namedParams: { user: 'gruntjs', repo: 'grunt', branch: 'master' },
staticExample: this.render({ status: 'success' }),
},
]

View File

@@ -59,8 +59,11 @@ function issueClassGenerator(raw) {
return [
{
title: 'Bitbucket open issues',
exampleUrl: 'atlassian/python-bitbucket',
pattern: ':user/:repo',
namedParams: {
user: 'atlassian',
repo: 'python-bitbucket',
},
staticExample: this.render({ issues: 33 }),
},
]

View File

@@ -88,14 +88,21 @@ module.exports = class BitbucketPipelines extends BaseJsonService {
return [
{
title: 'Bitbucket Pipelines',
exampleUrl: 'atlassian/adf-builder-javascript',
pattern: ':user/:repo',
namedParams: {
user: 'atlassian',
repo: 'adf-builder-javascript',
},
staticExample: this.render({ status: 'SUCCESSFUL' }),
},
{
title: 'Bitbucket Pipelines branch',
exampleUrl: 'atlassian/adf-builder-javascript/task/SECO-2168',
pattern: ':user/:repo/:branch',
namedParams: {
user: 'atlassian',
repo: 'adf-builder-javascript',
branch: 'task/SECO-2168',
},
staticExample: this.render({ status: 'SUCCESSFUL' }),
},
]

View File

@@ -56,8 +56,11 @@ function pullRequestClassGenerator(raw) {
return [
{
title: 'Bitbucket open pull requests',
exampleUrl: 'atlassian/python-bitbucket',
pattern: ':user/:repo',
namedParams: {
user: 'atlassian',
repo: 'python-bitbucket',
},
staticExample: this.render({ prs: 22 }),
},
]

View File

@@ -52,9 +52,10 @@ module.exports = class DockerAutomatedBuild extends BaseJsonService {
return [
{
title: 'Docker Automated build',
exampleUrl: 'jrottenberg/ffmpeg',
pattern: ':user/:repo',
keywords: ['docker', 'automated', 'build'],
namedParams: {
user: 'jrottenberg',
repo: 'ffmpeg',
},
staticExample: this.render({ isAutomated: true }),
},
]

View File

@@ -56,9 +56,10 @@ module.exports = class DockerBuild extends BaseJsonService {
return [
{
title: 'Docker Build Status',
exampleUrl: 'jrottenberg/ffmpeg',
pattern: ':user/:repo',
keywords: ['docker', 'build', 'status'],
namedParams: {
user: 'jrottenberg',
repo: 'ffmpeg',
},
staticExample: this.render({ status: 10 }),
},
]

View File

@@ -53,9 +53,10 @@ module.exports = class DockerPulls extends BaseJsonService {
return [
{
title: 'Docker Pulls',
exampleUrl: '_/ubuntu',
keywords: ['docker', 'pulls'],
pattern: ':user/:repo',
namedParams: {
user: '_',
repo: 'ubuntu',
},
staticExample: this.render({ count: 765400000 }),
},
]

View File

@@ -49,9 +49,10 @@ module.exports = class DockerStars extends BaseService {
return [
{
title: 'Docker Stars',
exampleUrl: '_/ubuntu',
pattern: ':user/:repo',
keywords: ['docker', 'stars'],
namedParams: {
user: '_',
repo: 'ubuntu',
},
staticExample: this.render({ stars: 9000 }),
},
]

View File

@@ -6,8 +6,7 @@ module.exports = class EclipseMarketplaceBase extends BaseXmlService {
static buildRoute(base) {
return {
base,
format: '(.+)',
capture: ['name'],
pattern: ':name',
}
}

View File

@@ -46,8 +46,7 @@ function DownloadsForInterval(interval) {
return [
{
title: 'Eclipse Marketplace',
exampleUrl: 'notepad4e',
pattern: ':name',
namedParams: { name: 'notepad4e' },
staticExample: this.render({ downloads: 30000 }),
},
]

View File

@@ -25,8 +25,7 @@ module.exports = class EclipseMarketplaceFavorites extends EclipseMarketplaceBas
return [
{
title: 'Eclipse Marketplace',
exampleUrl: 'notepad4e',
pattern: ':name',
namedParams: { name: 'notepad4e' },
staticExample: this.render({ favorited: 55 }),
},
]

View File

@@ -26,8 +26,7 @@ module.exports = class EclipseMarketplaceLicense extends EclipseMarketplaceBase
return [
{
title: 'Eclipse Marketplace',
exampleUrl: 'notepad4e',
pattern: ':name',
namedParams: { name: 'notepad4e' },
staticExample: this.render({ license: 'GPL' }),
},
]

View File

@@ -27,8 +27,7 @@ module.exports = class EclipseMarketplaceUpdate extends EclipseMarketplaceBase {
return [
{
title: 'Eclipse Marketplace',
exampleUrl: 'notepad4e',
pattern: ':name',
namedParams: { name: 'notepad4e' },
staticExample: this.render({ date: new Date().getTime() }),
},
]

View File

@@ -25,8 +25,7 @@ module.exports = class EclipseMarketplaceVersion extends EclipseMarketplaceBase
return [
{
title: 'Eclipse Marketplace',
exampleUrl: 'notepad4e',
pattern: ':name',
namedParams: { name: 'notepad4e' },
staticExample: this.render({ version: '1.0.1' }),
},
]

View File

@@ -103,8 +103,7 @@ module.exports = class FDroid extends BaseYamlService {
static get route() {
return {
base: 'f-droid/v',
format: '(.+)',
capture: ['appId'],
pattern: ':appId',
queryParams: ['metadata_format'],
}
}
@@ -113,15 +112,13 @@ module.exports = class FDroid extends BaseYamlService {
return [
{
title: 'F-Droid',
exampleUrl: 'org.thosp.yourlocalweather',
pattern: ':appId',
namedParams: { appId: 'org.thosp.yourlocalweather' },
staticExample: this.render({ version: '1.0' }),
keywords: ['fdroid', 'android', 'app'],
},
{
title: 'F-Droid (explicit metadata format)',
exampleUrl: 'org.dystopia.email',
pattern: ':appId',
namedParams: { appId: 'org.dystopia.email' },
queryParams: { metadata_format: 'yml' },
staticExample: this.render({ version: '1.2.1' }),
keywords: ['fdroid', 'android', 'app'],

View File

@@ -12,6 +12,8 @@ const { metric } = require('../../lib/text-formatters')
const { latest: latestVersion } = require('../../lib/version')
const { nonNegativeInteger } = require('../validators')
const keywords = ['ruby']
const gemsSchema = Joi.object({
downloads: nonNegativeInteger,
version_downloads: nonNegativeInteger,
@@ -122,43 +124,49 @@ module.exports = class GemDownloads extends BaseJsonService {
return [
{
title: 'Gem',
exampleUrl: 'dv/rails/stable',
pattern: 'dv/:package/stable',
pattern: 'dv/:gem/:version',
namedParams: {
gem: 'rails',
version: 'stable',
},
staticExample: this.render({
label: this._getLabel('stable', 'dv'),
downloads: 70000,
}),
keywords: ['ruby'],
keywords,
},
{
title: 'Gem',
exampleUrl: 'dv/rails/4.1.0',
pattern: 'dv/:package/:version',
pattern: 'dv/:gem/:version',
namedParams: {
gem: 'rails',
version: '4.1.0',
},
staticExample: this.render({
label: this._getLabel('4.1.0', 'dv'),
downloads: 50000,
}),
keywords: ['ruby'],
keywords,
},
{
title: 'Gem',
exampleUrl: 'dtv/rails',
pattern: 'dtv/:package',
pattern: 'dtv/:gem',
namedParams: { gem: 'rails' },
staticExample: this.render({
label: this._getLabel(undefined, 'dtv'),
downloads: 70000,
}),
keywords: ['ruby'],
keywords,
},
{
title: 'Gem',
exampleUrl: 'dt/rails',
pattern: 'dt/:package',
pattern: 'dt/:gem',
namedParams: { gem: 'rails' },
staticExample: this.render({
label: this._getLabel(undefined, 'dt'),
downloads: 900000,
}),
keywords: ['ruby'],
keywords,
},
]
}

View File

@@ -40,8 +40,7 @@ module.exports = class GemOwner extends BaseJsonService {
static get route() {
return {
base: 'gem/u',
format: '(.+)',
capture: ['user'],
pattern: ':user',
}
}
@@ -49,8 +48,7 @@ module.exports = class GemOwner extends BaseJsonService {
return [
{
title: 'Gems',
exampleUrl: 'raphink',
pattern: ':user',
namedParams: { user: 'raphink' },
staticExample: this.render({ count: 34 }),
keywords: ['ruby'],
},

View File

@@ -7,6 +7,8 @@ const { floorCount: floorCountColor } = require('../../lib/color-formatters')
const { ordinalNumber } = require('../../lib/text-formatters')
const { nonNegativeInteger } = require('../validators')
const keywords = ['ruby']
const totalSchema = Joi.array()
.items(
Joi.object({
@@ -25,13 +27,18 @@ const dailySchema = Joi.array()
.required()
module.exports = class GemRank extends BaseJsonService {
async fetch({ period, repo }) {
const totalRank = period === 'rt'
const endpoint = totalRank ? '/total_ranking.json' : '/daily_ranking.json'
const url = `http://bestgems.org/api/v1/gems/${repo}${endpoint}`
const schema = totalRank ? totalSchema : dailySchema
async fetch({ period, gem }) {
let endpoint, schema
if (period === 'rt') {
endpoint = 'total_ranking.json'
schema = totalSchema
} else {
endpoint = 'daily_ranking.json'
schema = dailySchema
}
return this._requestJson({
url,
url: `http://bestgems.org/api/v1/gems/${gem}/${endpoint}`,
schema,
})
}
@@ -46,8 +53,8 @@ module.exports = class GemRank extends BaseJsonService {
}
}
async handle({ period, repo }) {
const json = await this.fetch({ period, repo })
async handle({ period, gem }) {
const json = await this.fetch({ period, gem })
const rank = period === 'rt' ? json[0].total_ranking : json[0].daily_ranking
return this.constructor.render({ period, rank })
}
@@ -64,8 +71,7 @@ module.exports = class GemRank extends BaseJsonService {
static get route() {
return {
base: 'gem',
format: '(rt|rd)/(.+)',
capture: ['period', 'repo'],
pattern: ':period(rt|rd)/:gem',
}
}
@@ -73,17 +79,21 @@ module.exports = class GemRank extends BaseJsonService {
return [
{
title: 'Gem download rank',
exampleUrl: 'rt/puppet',
pattern: 'rt/:package',
pattern: 'rt/:gem',
namedParams: {
gem: 'puppet',
},
staticExample: this.render({ period: 'rt', rank: 332 }),
keywords: ['ruby'],
keywords,
},
{
title: 'Gem download rank (daily)',
exampleUrl: 'rd/facter',
pattern: 'rd/:package',
pattern: 'rd/:gem',
namedParams: {
gem: 'facter',
},
staticExample: this.render({ period: 'rd', rank: 656 }),
keywords: ['ruby'],
keywords,
},
]
}

View File

@@ -17,6 +17,8 @@ const schema = Joi.object({
.default([]),
}).required()
const keywords = ['pullrequest', 'detail']
module.exports = class GithubPullRequestCheckState extends GithubAuthService {
static get category() {
return 'build'
@@ -34,21 +36,29 @@ module.exports = class GithubPullRequestCheckState extends GithubAuthService {
{
title: 'GitHub pull request check state',
pattern: 's/pulls/:user/:repo/:number',
namedParams: {
user: 'badges',
repo: 'shields',
number: '1110',
},
staticExample: this.render({ which: 's', state: 'pending' }),
exampleUrl: 's/pulls/badges/shields/1110',
keywords: ['GitHub', 'pullrequest', 'detail', 'check'],
keywords,
documentation,
},
{
title: 'GitHub pull request check contexts',
pattern: 'contexts/pulls/:user/:repo/:number',
namedParams: {
user: 'badges',
repo: 'shields',
number: '1110',
},
staticExample: this.render({
which: 'contexts',
state: 'pending',
stateCounts: { passed: 5, pending: 1 },
}),
exampleUrl: 'contexts/pulls/badges/shields/1110',
keywords: ['GitHub', 'pullrequest', 'detail', 'check'],
keywords,
documentation,
},
]

View File

@@ -19,8 +19,11 @@ module.exports = class Gitter extends BaseStaticService {
{
title: 'Gitter',
pattern: ':user/:repo',
namedParams: {
user: 'nwjs',
repo: 'nw.js',
},
staticExample: this.render(),
exampleUrl: 'nwjs/nw.js',
},
]
}

View File

@@ -34,10 +34,10 @@ const hexSchema = Joi.object({
}).required()
class BaseHexPmService extends BaseJsonService {
async fetch({ pkg }) {
async fetch({ packageName }) {
return this._requestJson({
schema: hexSchema,
url: `https://hex.pm/api/packages/${pkg}`,
url: `https://hex.pm/api/packages/${packageName}`,
})
}
@@ -62,8 +62,8 @@ class HexPmLicense extends BaseHexPmService {
}
}
async handle({ pkg }) {
const json = await this.fetch({ pkg })
async handle({ packageName }) {
const json = await this.fetch({ packageName })
return this.constructor.render({ licenses: json.meta.licenses })
}
@@ -78,8 +78,7 @@ class HexPmLicense extends BaseHexPmService {
static get route() {
return {
base: 'hexpm/l',
format: '(.+)',
capture: ['pkg'],
pattern: ':packageName',
}
}
@@ -87,8 +86,7 @@ class HexPmLicense extends BaseHexPmService {
return [
{
title: 'Hex.pm',
pattern: ':package',
exampleUrl: 'plug',
namedParams: { packageName: 'plug' },
staticExample: this.render({ licenses: ['Apache 2'] }),
},
]
@@ -100,8 +98,8 @@ class HexPmVersion extends BaseHexPmService {
return { message: versionText(version), color: versionColor(version) }
}
async handle({ pkg }) {
const json = await this.fetch({ pkg })
async handle({ packageName }) {
const json = await this.fetch({ packageName })
return this.constructor.render({ version: json.releases[0].version })
}
@@ -112,8 +110,7 @@ class HexPmVersion extends BaseHexPmService {
static get route() {
return {
base: 'hexpm/v',
format: '(.+)',
capture: ['pkg'],
pattern: ':packageName',
}
}
@@ -121,8 +118,7 @@ class HexPmVersion extends BaseHexPmService {
return [
{
title: 'Hex.pm',
pattern: ':package',
exampleUrl: 'plug',
namedParams: { packageName: 'plug' },
staticExample: this.render({ version: '1.6.4' }),
},
]
@@ -153,8 +149,8 @@ function DownloadsForInterval(interval) {
}
}
async handle({ pkg }) {
const json = await this.fetch({ pkg })
async handle({ packageName }) {
const json = await this.fetch({ packageName })
return this.constructor.render({ downloads: json.downloads[interval] })
}
@@ -169,8 +165,7 @@ function DownloadsForInterval(interval) {
static get route() {
return {
base,
format: '(.+)',
capture: ['pkg'],
pattern: ':packageName',
}
}
@@ -178,8 +173,7 @@ function DownloadsForInterval(interval) {
return [
{
title: 'Hex.pm',
pattern: ':package',
exampleUrl: 'plug',
namedParams: { packageName: 'plug' },
staticExample: this.render({ downloads: 85000 }),
},
]

View File

@@ -26,9 +26,15 @@ module.exports = class Itunes extends LegacyService {
return [
{
title: 'iTunes App Store',
previewUrl: '803453959',
pattern: ':bundle-id',
exampleUrl: '803453959',
pattern: ':bundleId',
namedParams: {
bundleId: '803453959',
},
staticPreview: {
label: 'itunes app store',
message: 'v3.3.3',
color: 'blue',
},
},
]
}

View File

@@ -110,8 +110,12 @@ class JacocoJenkinsCoverage extends BaseJenkinsCoverage {
return [
{
title: 'Jenkins JaCoCo coverage',
exampleUrl: 'https/ci.eclipse.org/ecp/job/gerrit',
pattern: ':scheme/:host/:job',
pattern: ':scheme/:host/:job+',
namedParams: {
scheme: 'https',
host: 'ci.eclipse.org',
job: 'ecp/job/gerrit',
},
staticExample: this.render({
coverage: 96,
}),
@@ -151,8 +155,12 @@ class CoberturaJenkinsCoverage extends BaseJenkinsCoverage {
return [
{
title: 'Jenkins Cobertura coverage',
exampleUrl: 'https/builds.apache.org/job/olingo-odata4-cobertura',
pattern: ':scheme/:host/:job',
pattern: ':scheme/:host/:job+',
namedParams: {
scheme: 'https',
host: 'builds.apache.org',
job: 'job/olingo-odata4-cobertura',
},
staticExample: this.render({
coverage: 94,
}),

View File

@@ -107,8 +107,10 @@ class JenkinsPluginInstalls extends BaseJsonService {
return [
{
title: 'Jenkins Plugin installs',
exampleUrl: 'view-job-filters',
pattern: ':plugin',
namedParams: {
plugin: 'view-job-filters',
},
staticExample: this.render({
label: this._getLabel(),
installs: 10247,
@@ -116,8 +118,11 @@ class JenkinsPluginInstalls extends BaseJsonService {
},
{
title: 'Jenkins Plugin installs',
exampleUrl: 'view-job-filters/1.26',
pattern: ':plugin/:version',
namedParams: {
plugin: 'view-job-filters',
version: '1.26',
},
staticExample: this.render({
label: this._getLabel('1.26'),
installs: 955,

View File

@@ -33,8 +33,10 @@ module.exports = class JetbrainsDownloads extends JetbrainsBase {
return [
{
title: 'JetBrains IntelliJ plugins',
exampleUrl: '1347-scala',
pattern: ':pluginId',
namedParams: {
pluginId: '1347-scala',
},
staticExample: this.render({ downloads: 10200000 }),
},
]

View File

@@ -33,8 +33,10 @@ module.exports = class JetbrainsDownloads extends JetbrainsBase {
return [
{
title: 'JetBrains IntelliJ Plugins',
exampleUrl: '9630-a8translate',
pattern: ':pluginId',
namedParams: {
pluginId: '9630-a8translate',
},
staticExample: this.render({ version: 'v1.7' }),
},
]

View File

@@ -23,8 +23,11 @@ class LibrariesIoDependentRepos extends LibrariesIoBase {
return [
{
title: 'Dependent repos (via libraries.io)',
exampleUrl: 'npm/got',
pattern: ':platform/:library',
namedParams: {
platform: 'npm',
library: 'got',
},
staticExample: this.render({ dependentReposCount: 84000 }),
},
]

View File

@@ -23,8 +23,11 @@ class LibrariesIoDependents extends LibrariesIoBase {
return [
{
title: 'Dependents (via libraries.io)',
exampleUrl: 'npm/got',
pattern: ':platform/:library',
namedParams: {
platform: 'npm',
library: 'got',
},
staticExample: this.render({ dependentCount: 2000 }),
},
]

View File

@@ -24,8 +24,11 @@ class LibrariesIoSourcerank extends LibrariesIoBase {
return [
{
title: 'Libraries.io SourceRank',
exampleUrl: 'npm/got',
pattern: ':platform/:library',
namedParams: {
platform: 'npm',
library: 'got',
},
staticExample: this.render({ rank: 25 }),
},
]

View File

@@ -53,8 +53,7 @@ function DownloadsForInterval(interval) {
static get route() {
return {
base,
format: '(.*)',
capture: ['packageName'],
pattern: ':scope(@.+)?/:packageName',
}
}
@@ -62,8 +61,8 @@ function DownloadsForInterval(interval) {
return [
{
title: 'npm',
exampleUrl: 'localeval',
pattern: ':package',
pattern: ':packageName',
namedParams: { packageName: 'localeval' },
staticExample: this.render({ downloads: 30000 }),
keywords: ['node'],
},
@@ -77,10 +76,11 @@ function DownloadsForInterval(interval) {
}
}
async handle({ packageName }) {
async handle({ scope, packageName }) {
const slug = scope ? `${scope}/${packageName}` : packageName
let { downloads } = await this._requestJson({
schema,
url: `https://api.npmjs.org/downloads/${query}/${packageName}`,
url: `https://api.npmjs.org/downloads/${query}/${slug}`,
errorMessages: { 404: 'package not found or too new' },
})
if (isRange) {

View File

@@ -5,6 +5,8 @@ const { renderVersionBadge } = require('../../lib/version')
const { NotFound } = require('../errors')
const NpmBase = require('./npm-base')
const keywords = ['node']
// Joi.string should be a semver.
const schema = Joi.object()
.pattern(/./, Joi.string())
@@ -27,39 +29,39 @@ module.exports = class NpmVersion extends NpmBase {
return [
{
title: 'npm',
exampleUrl: 'npm',
pattern: ':package',
pattern: ':packageName',
namedParams: { packageName: 'npm' },
staticExample: this.render({ version: '6.3.0' }),
keywords: ['node'],
keywords,
},
{
title: 'npm (scoped)',
exampleUrl: '@cycle/core',
pattern: ':scope/:package',
pattern: ':scope/:packageName',
namedParams: { scope: '@cycle', packageName: 'core' },
staticExample: this.render({ version: '7.0.0' }),
keywords: ['node'],
keywords,
},
{
title: 'npm (tag)',
exampleUrl: 'npm/next',
pattern: ':package/:tag',
pattern: ':packageName/:tag',
namedParams: { packageName: 'npm', tag: 'next' },
staticExample: this.render({ tag: 'latest', version: '6.3.0' }),
keywords: ['node'],
keywords,
},
{
title: 'npm (custom registry)',
exampleUrl: 'npm/next',
pattern: ':package/:tag',
staticExample: this.render({ tag: 'latest', version: '7.0.0' }),
pattern: ':packageName/:tag',
namedParams: { packageName: 'npm', tag: 'next' },
queryParams: { registry_uri: 'https://registry.npmjs.com' },
keywords: ['node'],
staticExample: this.render({ tag: 'latest', version: '7.0.0' }),
keywords,
},
{
title: 'npm (scoped with tag)',
exampleUrl: '@cycle/core/canary',
pattern: ':scope/:packageName/:tag',
namedParams: { scope: '@cycle', packageName: 'core', tag: 'canary' },
staticExample: this.render({ tag: 'latest', version: '6.3.0' }),
pattern: ':scope/:package/:tag',
keywords: ['node'],
keywords,
},
]
}

View File

@@ -6,6 +6,8 @@ const { downloadCount } = require('../../lib/color-formatters')
const { metric } = require('../../lib/text-formatters')
const { nonNegativeInteger } = require('../validators')
const keywords = ['python']
const pypiStatsSchema = Joi.object({
data: Joi.object({
last_day: nonNegativeInteger,
@@ -75,24 +77,30 @@ module.exports = class PypiDownloads extends BaseJsonService {
return [
{
title: 'PyPI - Downloads',
exampleUrl: 'dd/Django',
pattern: 'dd/:package',
pattern: 'dd/:packageName',
namedParams: {
packageName: 'Django',
},
staticExample: this.render({ period: 'dd', downloads: 14000 }),
keywords: ['python'],
keywords,
},
{
title: 'PyPI - Downloads',
exampleUrl: 'dw/Django',
pattern: 'dw/:package',
pattern: 'dw/:packageName',
namedParams: {
packageName: 'Django',
},
staticExample: this.render({ period: 'dw', downloads: 250000 }),
keywords: ['python'],
keywords,
},
{
title: 'PyPI - Downloads',
exampleUrl: 'dm/Django',
pattern: 'dm/:package',
pattern: 'dm/:packageName',
namedParams: {
packageName: 'Django',
},
staticExample: this.render({ period: 'dm', downloads: 1070100 }),
keywords: ['python'],
keywords,
},
]
}