Commit Graph
1314 Commits
Author SHA1 Message Date
Paul MelnikowandThaddee Tyl 5a45003bc3 Test server logic for img2svg error, and run the server in-process
Running the server in process is necessary for the mock to work. This is an approach I’ve taken in the past. I experimented with this setup quite a bit when I was playing around with a test suite, and it seemed to work well enough. Setting `process.argv` is a admitedly a bit gross, though a cleaner approach would require more involved changes to `server.js`.
2017-04-12 23:13:16 +02:00
Paul MelnikowandThaddee Tyl 8b77d16a72 Always call the callback + reliable erroring
Fixes #914
2017-04-12 23:13:16 +02:00
Paul MelnikowandThaddee Tyl 0760d17d82 Return data from svg2img via callback
Given the chunks coming from imagemagick are getting stored memory and
then tucked into a cache, this function could as easily return a buffer
via callback. Streaming is just making it more complex. (And trickier to
test!)
2017-04-12 23:13:16 +02:00
Paul MelnikowandThaddee Tyl ad1e419d42 Add tests for svgToImg 2017-04-12 23:13:16 +02:00
Paul MelnikowandThaddee Tyl 3905424d1c Add a test for badge.js and refactor 2017-04-12 23:13:16 +02:00
Thaddee Tyl 2d71e844a2 Store raster badges in the LRU cache
In ef1a5159, the switch to using imagemagick made a faulty use of the library by
listening for an 'end' event that is never raised. As a result, the cache was
never populated.

In d985f81f, a fix that takes care of the fact that the previously mentioned
dead code relies on a non-existent variable caused it to kill the server when a
raster badge is requested twice, as what it stored in the cache was the pipe
transmitting chunks, not the chunks themselves, and the pipe (a Socket object)
cannot be subsequently sent through a pipe. The following error occured instead:

    events.js:163
          throw er; // Unhandled 'error' event
          ^

    TypeError: Invalid non-string/buffer chunk
        at chunkInvalid (_stream_readable.js:395:10)
        at readableAddChunk (_stream_readable.js:150:12)
        at DataStream.Readable.push (_stream_readable.js:136:10)
        at DataStream._read (/home/m/shields/lib/svg-to-img.js:45:21)
        at DataStream.Readable.read (_stream_readable.js:350:10)
        at resume_ (_stream_readable.js:739:12)
        at _combinedTickCallback (internal/process/next_tick.js:80:11)
        at process._tickDomainCallback (internal/process/next_tick.js:128:9)
2017-04-12 23:13:16 +02:00
Paul Melnikow 6e07fd0098 Update index.html with recent changes 2017-04-10 14:42:09 -04:00
Javier GonzálezandPaul Melnikow aa981cba84 iTunes app store version (#840) 2017-04-10 14:40:16 -04:00
Olivier LacanandGitHub 6f4c1fc3e3 Add more Shields users [ci skip] 2017-04-08 02:33:51 +02:00
Olivier LacanandGitHub 99c4c52f03 Create list of notable OSS projects using Shields
Talk about a proud daddy moment...
2017-04-08 02:27:46 +02:00
Paul MelnikowandPaul Melnikow 9669c9cacf Disambiguate provider vs package: Package Control
Correctly apply changes from #898, and update build of index.html.
2017-04-07 08:28:13 -04:00
Eddie WebbandPaul Melnikow b791ffda09 Add Docker Hub build status (#856) 2017-04-07 08:07:26 -04:00
Markus WamserandPaul Melnikow 3febfe234e Add support for CRAN/METACRAN (#837) 2017-04-05 17:30:47 -04:00
Paul MelnikowandPaul Melnikow 5a1e53254e Update website for April 2 deploy of 522e09f 2017-04-03 15:17:47 -04:00
Casey WebbandPaul Melnikow d462111370 Enable npm version for specific tag (#926)
* Enable npm version for specific tag
* Show tag in badge
2017-04-02 01:01:46 -04:00
Thaddee Tyl 522e09f509 Add missing var
It was fogotten when rebasing 5f945d48.
2017-03-30 23:40:49 +02:00
Nicco KunzmannandPaul Melnikow 21a3aef427 Add tutorial on how to add a new service (#889) 2017-03-30 11:46:10 -04:00
Kevin LockeandPaul Melnikow ced7f16645 [PATCH v2] Add support for swagger.io validator
The OpenAPI Specification (formerly known as the Swagger RESTful API
Documentation Specification) defines a format for describing RESTful
APIs.  The Swagger project provides a set of tools for working with this
format, including a hosted validator which provides a validation badge
and JSON result.[1]  This commit adds shields.io support for this badge.

The service currently only provides validation of files conforming to
version 2.0 of the OpenAPI Specification.  This commit adds a path
component for specifying the version under the assumption that the
validator may support version 3.0 or later as they are released.

It accepts the URL to validate as two path components, a scheme followed
by the rest of the URL, to match the convention used for the JIRA host
and webpage online shields.

Changes in v2:
- Use bitbucket in try.html example for clarity.
- Change /v/ in URL to /valid/ to avoid conflict with v=version.

1.  https://github.com/swagger-api/validator-badge

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2017-03-30 11:41:21 -04:00
Pavel DjundikandPaul Melnikow 84e2d6d7e3 Use spaces in "up to date" and "out of date" statuses 2017-03-30 00:04:37 -04:00
Peter Dave HelloandPaul Melnikow 75f7f047a2 Add link in cdnjs badge example 2017-03-29 22:35:16 -04:00
Thaddee TylandPaul Melnikow a0e6a6aeba Use new Buffer() instead of Buffer()
The following warning is emitted by Node.js:

> DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new
> Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or
> `Buffer.alloc()` instead.

This patch removes this warning.
2017-03-29 18:28:48 -04:00
Paul MelnikowandThaddee Tyl 1930d9fdd9 Change some .on to .once to make tests less flaky 2017-03-30 00:18:30 +02:00
Paul MelnikowandThaddee Tyl 076bd384d5 Use a glob pattern instead of hard-coding filenames 2017-03-30 00:18:30 +02:00
Paul MelnikowandThaddee Tyl 6985a778a0 Prevent lint errors 2017-03-30 00:18:30 +02:00
Paul MelnikowandThaddee Tyl 5f945d4856 Use Mocha to make tests more reliable 2017-03-30 00:18:30 +02:00
Peter Dave HelloandThaddee Tyl 2e4721ea1f Migrate to the new container based infra on Travis-ci
Use the "apt" add-on to install apt packages instead of using "apt-get"
command directly, and then move to the new container-based
infrastructure, which can speed up the build process.

PS: package "g++" removed from the list since it's already the
dependency of package "build-essential", no need to duplicate it.

Reference:
 - https://docs.travis-ci.com/user/ci-environment/
 - https://docs.travis-ci.com/user/installing-dependencies/
 - https://github.com/travis-ci/apt-package-whitelist/
2017-03-29 23:55:52 +02:00
Paul MelnikowandThaddee Tyl b410b0b7e7 Remove Talk.ai which no longer exists
No response at guest.talk.ai talk.ai, and nothing in google either
2017-03-29 20:14:26 +02:00
Paul MelnikowandThaddee Tyl d985f81f8e Disallow undefined variables 2017-03-29 20:09:30 +02:00
Paul MelnikowandThaddee Tyl 5a83b6c4a6 Show correct hostname and port in try.html URL 2017-03-29 19:58:14 +02:00
Paul MelnikowandThaddee Tyl 7c4b2b67e6 Add github standard node gitignores 2017-03-29 19:49:19 +02:00
Sebastian HoßandPaul Melnikow 7fad7268ef use greater-equals for SonarQube tech_debt colors
Projects that have '0' technical debt would otherwise receive a
lightgrey badge instead of a brightgreen one.

Signed-off-by: Sebastian Hoß <mail@shoss.de>
2017-03-29 13:24:39 -04:00
Akihiro UchidaandPaul Melnikow 7eeef988ba Fix imagelayers.io badges (#706)
Resolves #712
2017-03-28 00:30:32 -04:00
Paul Melnikow e8988a985c Clean lint from #1275 2017-03-27 17:18:50 -04:00
Michael HowellandPaul Melnikow 3dd0f96f77 Add docs.rs as a standard-compliant service
![mio on docs.rs](https://docs.rs/mio/badge.svg)
2017-03-27 17:05:17 -04:00
Pavel DjundikandPaul Melnikow c486c0dcd1 Reduce page jumping while all the badges are loading 2017-03-27 17:00:59 -04:00
DanialandPaul Melnikow 7843331f5f Add badge "404 | badge not found"
For invalid url specified ending in "svg, png, gif, jpg or json"
2017-03-27 16:58:24 -04:00
Frode KnutsenandPaul Melnikow 2133ff9d1f fix default value for githubUserTokens 2017-03-27 16:56:58 -04:00
Nicco KunzmannandPaul Melnikow 499c3ea724 add format documentation links
Problem: I wanted to know what color schema is available
Solution: Add links to directly reach the predefined schemes and templates
2017-03-27 16:56:10 -04:00
Francisco LourençoandPaul Melnikow 9b24ef7dbe Disambiguate provider vs package: Package Control
Spent some time trying to figure out how this was supposed to work :P
2017-03-27 16:54:39 -04:00
Paul Melnikow 0def6470a7 Disallow variable redeclaration 2017-03-26 20:02:56 -04:00
Thaddee Tyl 5dd58142cb Fix LRU cache index stalling
The old LRU implementation stored a list's indices to reference items in that
list, but deletions from the list made indices point to the wrong slot.

Functionally, it meant that deleted slots were not guaranteed to be the oldest
slot.

Using a linked list fixes that.
2017-03-26 23:00:31 +02:00
Thaddee Tyl 11b6e06f2f Organize local modules in lib 2017-03-26 22:57:55 +02:00
Paul Melnikow 47a8bf51dc First pass for linting on PRs 2017-03-20 16:54:27 -04:00
Thaddee Tyl ecd30480de Update maintenance badge for 2017 2017-02-26 20:57:35 +01:00
Thaddee Tyl 076cb14b3b Perform constant equal comparison for shared Shields secret
This should prevent timing attacks.
2017-02-25 18:20:07 +01:00
Thaddee Tyl 2f97be9118 Pre-compress badge templates with SVGO
Prior to this patch, time spend in badge.js (computing text width and
compressing the SVG with SVGO) averaged 8.4 ms.

After this patch, it clocks at 2.4 ms on average.

Assuming this is the CPU bottleneck, it means that servers used to only be able
to handle 119 req/s (empirically, it is closer to 100 req/s). It should now
handle 416 req/s (although a better guess is at 1/0.004 = 250 req/s).
2017-02-25 18:20:07 +01:00
Thaddee Tyl 38cf7a60b5 Use path.extname() to fetch template file name extension 2017-02-19 22:59:41 +01:00
Thaddee Tyl bf373d11cd Fix incorrect sendBadge() parameter order 2017-02-18 22:58:46 +01:00
Thaddee Tyl 4d937d859a Fix readme logo path 2017-02-16 23:19:33 +01:00
Thaddee Tyl 0758595b57 website: bitbucket open pull requests
Part of #790.
2017-02-15 23:57:19 +01:00