commercialhaskell/stackage-server

Allow customizing badge color

pgujjula opened this issue ยท 10 comments

Currently, Stackage badges show up as green. But it's common for badges representing published versions of software to be blue (some examples: ex 1, ex 2, ex 3). It would be useful to be able to customize the badge color with a query string. shields.io does this for Hackage.

Hey @pgujjula, can you point me to an example of a current Stackage badge?

Sure, here's some examples: Shelly, bitvec, world-peace

Oh I see, thanks! (I'm still learning the code base.)

The relevant markdown is

[![Stackage Nightly](http://stackage.org/package/shelly/badge/nightly)](http://stackage.org/nightly/package/shelly)

which renders as

Stackage Nightly

Thus the endpoint to change is /package/#PackageNameP/badge/#SnapshotBranch, which is handled by the function Handler.Package.getPackageBadgeR.

It looks like the endpoint already supports some query params, so adding a color param should be straightforward.

Sounds good, thanks for the consideration!

Would you want to contribute a patch? I myself won't have time for this right now. :)

Yeah I can work on it sometime this week :)

Hey @chreekat, I went through the README to set up the project. I was able to successfully run the dev server with yesod devel, but it seems like there's no packages, so I can't test badges. In order to run the postgresql-based server, I tried running the cron job to set up the database, but I get an error:

$ export PGSTRING=postgresql://postgres:postgres@localhost:5432/stackage
$ stack exec stackage-server-cron
*** Exception: CredentialChainExhausted

CredentialChainExhausted is an amazonka error, do I need access to AWS?

Or perhaps there is a simpler way for me to get test data for development?

Oof, I forgot about that. I don't know how to get around the problem of missing packages. (I'm still new to maintaining this project, so maybe there's a way I just don't know.)

I think creating test data for local development is worth its own issue. But it doesn't have to block the badge color project.

For badge color, go ahead and put up a PR when you think it seems good enough. We can fall back and rely on code review and testing it live ๐Ÿ™ƒ

I opened a PR here: #331 :)