This was designed as part of a rewrite of the Github auth code in #1205 which is stalled because I don't want to deploy it without access to server logs. The need for token rotation came up recently in #541, so I picked up this code, removed the github-specific bits, and pulled it in. Ordinarily I wouldn't merge helper code without a use, though sadly it seems like the best way to move forward this rewrite.
* add support for rgb, rgb, css named colors
* add support for hsl, hsla & add color-validate
* update makeBadge test, better coverage
* re-add comment
* add comment for supported colors
* dynamic badge gen, remove 'hex'
* add support for 1.0 opacity & fix 101-109
* fix colorscheme tests
* remove extra tests
* add test for negative values
* add test for uppercase & mixed case colors
* fix mixed case/uppercase test
* allow whitespace around color
* update test error messages
* add comments
* add more uppercase test
* update error message
* default to grey/red if invalid color chosen
default colorscheme:
colorA: grey
colorB: red
* Revert "default to grey/red if invalid color chosen"
This reverts commit 10db0c6d74.
Reverted as this affects the CLI version/when no color specified.
* validColor -> isCSSColor
* assignColor function
* update tests to use sazerac
* Add Jenkins Jacoco coverage badge
* [Jenkins] add service test for jacoco coverage
* Added Jenkins Coverage (Jacoco) in all-badge-examples page
* Defined variables using let/const instead of var
* Used template string for the uri
* Used checkErrorResponse helper function for the error check
* Used NaN method for not a number test
* Prefixed the original Jenkin coverage test with "cobertura:"
* Moved the happy test case at front
* Merge the business logic between jacoco and cobertura
* Fixed lint issue
* Trigger notification
fix [waffle] labels badge
- update URL and parsing code to use /columns endpoint
- add error handling for 'not found' case
- add missing test cases
- update home page example
Closes#1731
* Basic version of commit-status badge added
* Support for case with no common ancestor
* Handle unknown branch
* Service tests with error responses
* Handle unexpected 404 responses from github
* Branch is a base
* Tests reordered
* Using not the newest commit in tests
* Test for checked commit identical with the newest commit in branch
* Code refactoring
* Example for Github commit merge status
* allow services to export >1 classes
This change to loadServiceClasses() allows us to define
services which either export a single service class e.g:
module.exports = class Cdnjs extends BaseService {
//...
}
or more than one. e.g:
module.exports = {
GemVersion,
GemDownloads,
GemOwner,
GemRank,
}
* refactor ruby gem badges
- move badge code to service classes
- throw exceptions for errors
- use let and const
- change tests to expect 'downloads' label for error badges
- general tidying
* fix typo in tests
* Don't always use class name in example label
This allows (for example) GemVersion and GemDownloads
both to use the example label 'Gem'
* pass error object to InvaildResponse()
this prevents us from throwing
TypeError: Cannot read property 'stack' of undefined
when we attempt to parse invalid json
* refactor [cdnjs] integration
* Support for buildkite
* Added to the examples as well
* Removed the unnecessary label property
* Fixed the example
* Improve the tests
* Made the branch optional and review suggestions
* Added network error test
* Unexpected response test
* PR review suggestions
* Updated test to include all responses
* Forgot one of the tests
Make a clear distinction between programmer errors ("internal errors") and runtime errors, and allow configuring the server to let the programmer errors bubble up in development and unit testing. This saves a huge amount of time because it generates ordinary stack traces when things go wrong. And, if these errors occur in production, we'll catch them, and display **shields | internal error** which is the equivalent of a 500 error.
Instead of centralizing examples, specify them from within a service.
* Avoid duplication in service loading + refactor
* Avoid duplication in URLs, rename uri -> url in BaseService
This resolves the following error occurring in production:
```
TypeError: Cannot read property 'slice' of null
/home/m/shields/lib/suggest.js in twitterPage at line 63:31
const schema = url.protocol.slice(0, -1);
```
This resolves the following error occurring in production:
```
TypeError: Cannot read property 'slice' of null
/home/m/shields/lib/suggest.js in findSuggestions at line 40:33
const userRepo = url.pathname.slice(1).split('/');
```
This merges the `node-8` branch. The heavy lift was by @Daniel15 with refactoring from me and a patch by @RedSparr0w.
* New API for registering services (#963)
* Disable Node 6 tests on node-8 branch (#1423)
* BaseService: Factor out methods _regex and _namedParamsForMatch (#1425)
- Adjust test grouping
- Rename data -> queryParams, text -> message
* BaseService tests: Use Chai (#1450)
* BaseService: make serviceData and badgeData explicit and declarative (#1451)
* fix isValidStyle test (#1544)
* Run tests in Node 9, not Node 6 (#1543)
These tests should fail if something is accidentally changed that affects the SVG or JSON files. In the case of deliberate changes, we can update the snapshots.
* remove newlines from datauri
* update test, remove decode
* support multiline datauris
* replace whitespace before checking isDataUri
removed multiline support from regex
* prependPrefix set default as empty string
* update