Build a badge service wheel.

Source: Internet
Author: User

What is badge Service

Attentive reader friends must have seen badges like these on many GitHub REPO,NPM's package pages. What are these badges for?

As you can see, the left side of the badge I quoted above, is,, and so on, it is Downloads Build Dependency not difficult to guess, these badge are used for some information statistics, and then shown in the form of pictures. For example, I have a small project delta is written in JS, I used the Travis CI for continuous compilation and testing. Every time I checkin a new code, Travis CI builds the latest code, and then draws the result of the build into a vector diagram and puts it https://travis-ci.org/rebornix/delta.svg down. So the students will be able to timely from my Project home page to see the project's recent build situation, if it hangs, you can wantonly explode me.

In fact, this is a numbers into a picture of the gadget.

Shield Badge

In order to let. NET world friends are as cool as front-end friends, and we decided to provide such services in Visual Studio Gallery. Soon I wrote a version that was used to generate PNG. The effect is good, but PNG's only drawback is that it can't scale, and it's better if you can generate a vector graph. Because. NET is inherently handicapped in drawing vectors, and I'm trying to find out if there's a solution out there. So I found the sheild.io.

Shield provides a set of plans to draw badge, and open source Nodejs, PHP, go and other languages to implement, and even they provide a service Shield.io convenient for everyone to use. It's almost perfect.

Then why do I have to build wheels?

The reason is quite simple, and shield is unlikely to provide SLAs like Azure,aws (and we should not ask them for it). We want to reduce this external dependency as much as possible for our website. Since they are open source, I have just written one. NET version, manage assembly through NuGet, and run the service on our own machine. I gave it a very vulgar name, called Dotbadge, we can go to GitHub onlookers.

How to use

You can use NuGet to download the DLL to reference, and for everyone to better play already experience, I wrote a small command line tool.

Command-line tools

Download

Open the command line to the Dotbadge directory and execute DotBadge.exe --help .

Example
DOTBADGE.EXE-SB "Downloads"-st "+"-C "Green"-SL 0

How to put it in your own project

Run in NuGet's package Manager console

Pm> Install-package Dotbadge

 or search for downloads using NuGet's UI tool.

Example
Using dotbadge;using system.io;namespace badge{    class program    {        static void Main (string[] args)        {            var bp = new Badgepainter ();            File.writealltext (@ "C:\Users\peng\Desktop\nuget.svg", BP. Drawsvg ("Badge", ". Net", colorscheme.red, Style.flat));}}    
Making wheels is full of fun

Build a badge service wheel.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.