Code Monkey home page Code Monkey logo

Comments (53)

dlangille avatar dlangille commented on July 21, 2024

I do not recall seeing badges before.

Where would these badges appear?

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

For example, there's pypi badge in ansible you've forked:

https://github.com/dlangille/ansible#readme

Actually they are used in most repos:

https://github.com/chef/chef#readme
https://github.com/bower/bower#readme
https://github.com/docker/docker#readme

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I see what you mean now. It is a way for a given project to indicate that their software is available on FreeBSD.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Yes, however if you put it that way a project could just generate a badge themselves. With Freshports though, the badge will also show version which is a lot more useful. Just though that you can also indicate broken status with color.

FreeBSD port
FreeBSD port (BROKEN/IGNORE/DEPRECATED)
FreeBSD port (unknown port requested, e.g. the port was removed)

To catch removed ports it's looks better to be implemented as a separate script, e.g. freshports.org/badge.php?port=x11/xproto

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Yes, the above is what I thought you were getting at. I suspect badges.freshports.org/x11/xproto sounds like fun.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I'd like commits.freshports.org instead of commit.php?message_id....

The goal being to make www.freshports.org 'cleaner'.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Yes, would be great!

You could also set up a script to generate markdown code suitable for inclusion in README.md, e.g.

[![FreeBSD port](http://badges.freshports.org/${CATEGORY}/${PORT})](http://freshports.org/${CATEGORY}/${PORT})

(this is badge image which links to port's page on freshports) and add link to that from

SVNWeb : Homepage : Distfiles Availability : PortsMon : Badge

line on a ports page.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

After a short discussion at FreeBSD Developers summit in Stockholm, I think www.freshports.org/--/badges/ may be a better idea. Fewer certificates, host names, and web instances to maintain. It could also be used www.freshports.org/--/API/ (re https://duck.co/ideas/idea/936/grab-bsd-port-summary-from-freshports)

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

I'm good with either. Also 👍 to API, as with it FP could be also ingerdated with shields.io directly.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

See http://dev.freshports.org/--/badges/?port=x11/xproto

Is this what you were expecting?

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Proof of concept. There is no error handling yet (always returns 200).

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Well not quite. It should either generate a redirect to badges.io link which it self shows a needed svg (example of such link is in the top post), or json with enough info for badges.io to generate it itself (which would be even better).

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Actually badge can be generated from this as well, but i'd name it /version/ instead of /badge/ then, and JSON would still be more flexible.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Oops, accidental close.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

FYI badges.io is for sale.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I got it: https://img.shields.io/badge/Bacula--Server-7.0.2_1-green.svg?style=plastic

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Examples:

https://img.shields.io/badge/Bacula--Server-7.0.2_1-red.svg?style=plastic
https://img.shields.io/badge/bacula--server-7.0.2__1-red.svg

Next step: figure out JSON, which I'm not seeing a reference to on their website.

i.e. this does not work:

https://img.shields.io/badge/bacula--server-7.0.2__1-red.json

from freshports.

dlangille avatar dlangille commented on July 21, 2024

At present, http://dev.freshports.org/--/badges/?port=sysutils/bacula-client produces an IMG element if found, and a 404 otherwise.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024
  • It should produce link instead of img element as the latter cannot be embedded into markdown.
  • Version shouldn't include PORTREVISION and PORTEPOCH
  • Color should be blue by default (most packaging systems do so), and red if BROKEN/IGNORE is present
  • Instead of 404, it should produce a link to gray badge with "not found" text or something similar

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024
  • Left-hand text should say "FreeBSD port" so it's apparent what the badge represents
  • This text should stay for `not found' case, e.g. FreeBSD port | not found

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Compare http://dev.freshports.org/--/badges/?port=archivers/hlextract and http://dev.freshports.org/--/badges/?port=sysutils/bacula-client

The img is included with the HTML for debugging.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Apart from 2 items from my last comment, good.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Try now, not sure yet about the Not Found issue: http://dev.freshports.org/--/badges/?port=not/foundtest

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Yes, almost good - I'd use lightgray instead of gray as it seems pretty common for other badges.

Also note that for not found case generated URL != generated img src (though img src is correct).

from freshports.

dlangille avatar dlangille commented on July 21, 2024

How's that?

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Still to do: caching.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Absolutely perfect! Thank you!

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Could you please remove now? I'd like to test this on one of my repos.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Try now. Before moving to production, I suspect the URL / parameters may change.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Uh, it should redirect (with 303 code I think) to the url, not show it.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Done

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Yeah, now it works:

https://github.com/AMDmi3/libSDL2pp/tree/ports-badge

Waiting for production state of this feature :)

Also not sure, but maybe s/Port/port/ would look a bit better.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I changed to lower case. Seems they are caching it.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Yep, github could. Direct link has lowercase port.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Although it is disturbing, seems like it's caching the redirect while it shouldn't - this means that even if the version is updated, GH will still show an old badge. According ti http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html, you should redirect with 303 (which is non cacheable) or provide corresponding Cache-Control / Expires headers.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Code was: header("Location: $badge");

now: header("Location: $badge", true, 303);

re http://php.net/manual/en/function.header.php

But it will take some time for that cache to wear off

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Thank you! We'll see if it helps.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

FYI, I am creating a branch, badges, so I can commit this work in progress without affecting production. Then I will checkout this code for use on http://beta.freshports.org/ and that will allow me to keep working on dev, which is my personal sandbox.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

This should now work on http://beta.freshports.org/ :

Please update your URLs to point to beta, but anticipate that the URL / form may change after REST is implemented.

Expect dev to be broken for some time while I work on REST.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Please update your URLs to point to beta, but anticipate that the URL / form may change after REST is implemented.

Done

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I just pushed the badges branch. It's no longer just on my dev site.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

E.g. it should be available on freshports.org? It doesn't seem to (or is the url different?)

http://www.freshports.org/--/badges/?port=archivers/hlextract

 Sorry, but I don't know anything about that.

/--/badges/?port=archivers/hlextract

from freshports.

dlangille avatar dlangille commented on July 21, 2024

No, not yet. It is on the branch and needs to be merged into the main tree, but I want to configure caching before I do that.

from freshports.

AMDmi3 avatar AMDmi3 commented on July 21, 2024

Any news on this?

from freshports.

dlangille avatar dlangille commented on July 21, 2024

It is sad isn't it?

I'm now busy with EuroBSDCon prep...

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I managed to get this working in VMware on my laptop. I'm flying tomorrow.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I wonder what I need to cache here. It is just a redirect.

Here's the fetch:

[dan@dent:~] $ wget -S http://192.168.165.128/--/badges/?port=archivers/hlextract
--2016-10-21 21:42:18-- http://192.168.165.128/--/badges/?port=archivers/hlextract
Connecting to 192.168.165.128:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 303 See Other
Date: Thu, 20 Oct 2016 00:42:55 GMT
Server: Apache/2.2.31 (FreeBSD) PHP/5.5.32 mod_ssl/2.2.31 OpenSSL/1.0.2f DAV/2
X-Powered-By: PHP/5.5.32
Location: https://img.shields.io/badge/FreeBSD_port-2.4.4-red.png
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
Location: https://img.shields.io/badge/FreeBSD_port-2.4.4-red.png [following]
--2016-10-21 21:42:18-- https://img.shields.io/badge/FreeBSD_port-2.4.4-red.png
Resolving img.shields.io (img.shields.io)... 104.18.44.160, 104.18.45.160, 2400:cb00:2048:1::6812:2da0, ...
Connecting to img.shields.io (img.shields.io)|104.18.44.160|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Sat, 22 Oct 2016 02:42:20 GMT
Content-Type: image/png
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d47352fea27e152c5a71682f8bfc382501477104140; expires=Sun, 22-Oct-17 02:42:20 GMT; path=/; domain=.shields.io; HttpOnly
Cache-Control: max-age=86400
Last-Modified: Sat, 22 Oct 2016 00:29:12 GMT
Server: cloudflare-nginx
CF-RAY: 2f59986f8bb358af-DFW
Length: unspecified [image/png]
Saving to: ‘index.html?port=archivers%2Fhlextract’

index.html?port=archivers%2Fhlextract [ <=> ] 2.42K --.-KB/s in 0.001s

2016-10-21 21:42:21 (4.27 MB/s) - ‘index.html?port=archivers%2Fhlextract’ saved [2478]

[dan@dent:~]

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Everything is just read from the DB. That should be fast for now. I'll see what I need to do to get this working on the plane tomorrow,

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I do believe this has been merged from the badges branch to the master branch.

4e202da

I'll cleanup the files during the flight and this should be on dev.freshports.org later this weekend.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Reopening, until we are in production.

from freshports.

dlangille avatar dlangille commented on July 21, 2024

I see we are in production. I missed that.

How's it looking?

from freshports.

dlangille avatar dlangille commented on July 21, 2024

Still waiting to hear back from OP.

badges question raised again here: https://twitter.com/f0andrey/status/1049027503199858688

from freshports.

grahamperrin avatar grahamperrin commented on July 21, 2024

#3 (comment)

… for 'not found' case, …

See also:

Is there any overlap? (If not, I can delete this comment.)

from freshports.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.