Comments (53)
I do not recall seeing badges before.
Where would these badges appear?
from freshports.
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.
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.
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.
(BROKEN/IGNORE/DEPRECATED)
(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.
Yes, the above is what I thought you were getting at. I suspect badges.freshports.org/x11/xproto
sounds like fun.
from freshports.
I'd like commits.freshports.org
instead of commit.php?message_id....
The goal being to make www.freshports.org
'cleaner'.
from freshports.
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.
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.
I'm good with either. Also 👍 to API, as with it FP could be also ingerdated with shields.io directly.
from freshports.
See http://dev.freshports.org/--/badges/?port=x11/xproto
Is this what you were expecting?
from freshports.
Proof of concept. There is no error handling yet (always returns 200).
from freshports.
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.
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.
Oops, accidental close.
from freshports.
FYI badges.io is for sale.
from freshports.
I got it: https://img.shields.io/badge/Bacula--Server-7.0.2_1-green.svg?style=plastic
from freshports.
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.
At present, http://dev.freshports.org/--/badges/?port=sysutils/bacula-client produces an IMG element if found, and a 404 otherwise.
from freshports.
- 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.
- 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.
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.
Apart from 2 items from my last comment, good.
from freshports.
Try now, not sure yet about the Not Found issue: http://dev.freshports.org/--/badges/?port=not/foundtest
from freshports.
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.
How's that?
from freshports.
Still to do: caching.
from freshports.
Absolutely perfect! Thank you!
from freshports.
Could you please remove now? I'd like to test this on one of my repos.
from freshports.
Try now. Before moving to production, I suspect the URL / parameters may change.
from freshports.
Uh, it should redirect (with 303 code I think) to the url, not show it.
from freshports.
Done
from freshports.
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.
I changed to lower case. Seems they are caching it.
from freshports.
Yep, github could. Direct link has lowercase port
.
from freshports.
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.
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.
Thank you! We'll see if it helps.
from freshports.
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.
This should now work on http://beta.freshports.org/ :
- http://beta.freshports.org/--/badges/?port=archivers/hlextract
- http://beta.freshports.org/--/badges/?port=sysutils/bacula-client
- http://beta.freshports.org/--/badges/?port=fake/fake
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.
Please update your URLs to point to beta, but anticipate that the URL / form may change after REST is implemented.
Done
from freshports.
I just pushed the badges branch. It's no longer just on my dev site.
from freshports.
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.
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.
Any news on this?
from freshports.
It is sad isn't it?
I'm now busy with EuroBSDCon prep...
from freshports.
I managed to get this working in VMware on my laptop. I'm flying tomorrow.
from freshports.
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.
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.
I do believe this has been merged from the badges branch to the master branch.
I'll cleanup the files during the flight and this should be on dev.freshports.org later this weekend.
from freshports.
Reopening, until we are in production.
from freshports.
I see we are in production. I missed that.
How's it looking?
from freshports.
Still waiting to hear back from OP.
badges question raised again here: https://twitter.com/f0andrey/status/1049027503199858688
from freshports.
… for 'not found' case, …
See also:
Is there any overlap? (If not, I can delete this comment.)
from freshports.
Related Issues (20)
- ABI permissions
- Categories: Deprecated: Creation of dynamic property Categories::$dbh is deprecated in /usr/local/www/freshports/classes/category-listing.php on line 16 HOT 2
- Cannot delete a port from a watch list. HOT 1
- Notification: New Package Available: testing by users HOT 20
- Rotate the table for packages HOT 8
- Do not display the quarterly branch for -CURRENT - that is never built HOT 10
- pkg-message not displayed HOT 3
- search error HOT 1
- sqlmap package issue. HOT 2
- x11-servers/xwayland historical port versions apply PORTEPOCH to versions before it was added. HOT 9
- Warning: Undefined array key "wlid" in /usr/local/www/freshports/www/watch-list.php on line 236
- a port on a quarterly branch should not be considered new
- Increase watch list limit? HOT 5
- sanity test failures should mention branch if on quarterly
- SSLH 2.1.2? HOT 3
- no Conflicts Matches for this port - accurate or not? HOT 3
- Very few packages
- Sort package names by version, not the way it is done now HOT 1
- Move new account captcha above the create account button HOT 5
- No package information for editors/vscode HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freshports.