Example #1
0
        public string Process(
            IDictionary <object, object> config,
            IMarkdownReferences references,
            IHaveSolution build
            )
        {
            if (!(config.TryGetValue("github", out var githubObj) && config.TryGetValue("codacy", out var codacyObj)))
            {
                return(string.Empty);
            }

            var github = (IDictionary <object, object>)githubObj;
            var codacy = (IDictionary <object, object>)codacyObj;
            var url    = references.AddReference(
                "codacy",
                $"https://www.codacy.com/app/{github["owner"]}/{github["repository"]}"
                );
            var badge = references.AddReference(
                "codacy-badge",
                $"https://api.codacy.com/project/badge/Grade/{codacy["project"]}",
                "Codacy"
                );

            return($"[!{badge}]{url}");
        }
Example #2
0
        public (string badge, string history) Process(
            IDictionary <object, object> config,
            IMarkdownReferences references,
            ICanUpdateReadme build
            )
        {
            var url = references.AddReference(
                "appveyor",
                $"https://ci.appveyor.com/project/{config["account"]}/{config["build"]}"
                );
            var badge = references.AddReference(
                "appveyor-badge",
                $"https://img.shields.io/appveyor/ci/{config["account"]}/{config["build"]}.svg?color=00b3e0&label=appveyor&logo=appveyor&logoColor=00b3e0&style=flat",
                "AppVeyor Status"
                );
            var historyUrl = references.AddReference(
                "appveyor-history",
                $"https://ci.appveyor.com/project/{config["account"]}/{config["build"]}/history"
                );
            var historyBadge = references.AddReference(
                "appveyor-history-badge",
                $"https://buildstats.info/appveyor/chart/{config["account"]}/{config["build"]}?includeBuildsFromPullRequest=false",
                "AppVeyor History"
                );

            return($"[!{badge}]{url}", $"[!{historyBadge}]{historyUrl}");
        }
Example #3
0
        public string GetResult(IDictionary <string, object> config, IMarkdownReferences references, string packageName)
        {
#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
            using var hasher = MD5.Create();
#pragma warning restore CA5351 // Do Not Use Broken Cryptographic Algorithms
#pragma warning disable CA1307
#pragma warning disable CA1308 // Normalize strings to uppercase
            var hash = Convert.ToBase64String(hasher.ComputeHash(Encoding.ASCII.GetBytes(packageName)))
                       .Replace("=", "")
                       .Substring(10)
                       .ToLowerInvariant();
#pragma warning restore CA1308 // Normalize strings to uppercase
#pragma warning restore CA1307
            var nugetUrlReference = references.AddReference($"nuget-{hash}", NugetUrl(packageName));
            var nugetVersionBadge = references.AddReference(
                $"nuget-version-{hash}-badge",
                NuGetVersionBadge(packageName),
                "NuGet Version"
                );
            var nugetDownloadsBadge = references.AddReference(
                $"nuget-downloads-{hash}-badge",
                NuGetDownloadsBadge(packageName),
                "NuGet Downloads"
                );
            if (!config.ContainsKey("myget"))
            {
                return($"| {packageName} | [!{nugetVersionBadge}!{nugetDownloadsBadge}]{nugetUrlReference} |");
            }

            var dcfg              = config;
            var myget             = dcfg["myget"] as IDictionary <object, object>;
            var mygetUrlReference = references.AddReference(
                $"myget-{hash}",
                MyGetUrl(myget !["account"].ToString() !, packageName)
Example #4
0
        public (string badge, string history) Process(
            IDictionary <object, object> config,
            IMarkdownReferences references,
            RocketBoosterBuild build
            )
        {
            var url = references.AddReference(
                "azurepipelines",
                $"https://{config["account"]}.visualstudio.com/{config["teamproject"]}/_build/latest?definitionId={config["builddefinition"]}&branchName=master"
                );
            var badge = references.AddReference(
                "azurepipelines-badge",
                $"https://img.shields.io/azure-devops/build/{config["account"]}/{config["teamproject"]}/{config["builddefinition"]}.svg?color=98C6FF&label=azure%20pipelines&logo=azuredevops&logoColor=98C6FF&style=flat",
                "Azure Pipelines Status"
                );
            var historyUrl = references.AddReference(
                "azurepipelines-history",
                $"https://{config["account"]}.visualstudio.com/{config["teamproject"]}/_build?definitionId={config["builddefinition"]}&branchName=master"
                );
            var historyBadge = references.AddReference(
                "azurepipelines-history-badge",
                $"https://buildstats.info/azurepipelines/chart/{config["account"]}/{config["teamproject"]}/{config["builddefinition"]}?includeBuildsFromPullRequest=false",
                "Azure Pipelines History"
                );

            return($"[!{badge}]{url}", $"[!{historyBadge}]{historyUrl}");
        }
Example #5
0
        public string Process(
            IDictionary <object, object> config,
            IMarkdownReferences references,
            ICanUpdateReadme build
            )
        {
            var url = references.AddReference(
                "codecov",
                $"https://codecov.io/gh/{config["owner"]}/{config["repository"]}"
                );
            var badge = references.AddReference(
                "codecov-badge",
                $"https://img.shields.io/codecov/c/github/{config["owner"]}/{config["repository"]}.svg?color=E03997&label=codecov&logo=codecov&logoColor=E03997&style=flat",
                "Code Coverage"
                );

            return($"[!{badge}]{url}");
        }
Example #6
0
        public string Process(
            IDictionary <object, object> config,
            IMarkdownReferences references,
            IHaveSolution build
            )
        {
            var url = references.AddReference(
                "github-license",
                $"https://github.com/{config["owner"]}/{config["repository"]}/blob/master/LICENSE"
                );
            var badge = references.AddReference(
                "github-license-badge",
                $"https://img.shields.io/github/license/{config["owner"]}/{config["repository"]}.svg?style=flat",
                "License"
                );

            return($"[!{badge}]{url}");
        }
Example #7
0
        public string Process(
            IDictionary <object, object> config,
            IMarkdownReferences references,
            ICanUpdateReadme build
            )
        {
            var url = references.AddReference(
                "github-release",
                $"https://github.com/{config["owner"]}/{config["repository"]}/releases/latest"
                );
            var badge = references.AddReference(
                "github-release-badge",
                $"https://img.shields.io/github/release/{config["owner"]}/{config["repository"]}.svg?logo=github&style=flat",
                "Latest Release"
                );

            return($"[!{badge}]{url}");
        }
Example #8
0
        public (string badge, string history) Process(
            IDictionary <object, object> config,
            IMarkdownReferences references,
            IHaveSolution build
            )
        {
            var url = references.AddReference(
                "github",
                $"https://github.com/{config["owner"]}/{config["repository"]}/actions?query=workflow%3Aci"
                );
            var badge = references.AddReference(
                "github-badge",
                $"https://img.shields.io/github/workflow/status/{config["owner"]}/{config["repository"]}/ci.svg?label=github&logo=github&color=b845fc&logoColor=b845fc&style=flat",
                "GitHub Actions Status"
                );
            var historyBadge = references.AddReference(
                "github-history-badge",
                $"https://buildstats.info/github/chart/{config["owner"]}/{config["repository"]}?includeBuildsFromPullRequest=false",
                "GitHub Actions History"
                );

            return($"[!{badge}]{url}", $"[!{historyBadge}]{url}");
        }