gcollazo / ember-cli-addon-search

This project is no longer maintained please visit Ember Observer

Home Page:https://emberobserver.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display Travis Badges

gcollazo opened this issue · comments

I tried showing travis badges on addons but it turns out this might be a tittle bit tricky. What I did was use the repository information from NPM to construct the travis badge url.

When that repo has a travis setup it works perfectly but if the user has not connected that specific repo with travis, the server will reply with JSON instead of an image which causes the badge to look broken.

@stefanpenner, @jpadilla any ideas?

@gcollazo so, if we do this we could just encourage people to use travis (its not hard)

@drogus any suggestions to ^^ we can to automatically have travis badges for ember-addons if they are available, if they are not currently we get json back. Would it be possible to instead have an appropriate image response?

There's an unknown badge that would work well for this case instead of a JSON response, but that might already be expected for something else. Currently checking https://github.com/travis-ci/travis-api.

My suggested workaround was to do something like:

<img src="https://api.travis-ci.org/jpadilla/nonexistent.svg?branch=master" onerror="this.src='http://travis-not-found-badge.com'">

@jpadilla that works! As for the error image we could use a 1 pixel transparent GIF. Thoughts?

So I went with:

<img src="https://api.travis-ci.org/jpadilla/nonexistent.svg?branch=master" onerror="this.style.display='none'">

It's already up.

Sorry for that, definitely seems like a bug in Travis CI API. I'll look into it.