From ce8bf06e9d51b5265c8f61d11237c68d9281968b Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Wed, 8 Jan 2025 17:19:24 +0100 Subject: [PATCH] Link to licenses --- src/main/kotlin/org/openrewrite/Licenses.kt | 7 ++++++- src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/openrewrite/Licenses.kt b/src/main/kotlin/org/openrewrite/Licenses.kt index 26cf71d..1c6f270 100644 --- a/src/main/kotlin/org/openrewrite/Licenses.kt +++ b/src/main/kotlin/org/openrewrite/Licenses.kt @@ -5,11 +5,16 @@ enum class License { MSAL, Proprietary; - override fun toString() = when(this) { + fun label() = when(this) { Apache2 -> "Apache License Version 2.0" MSAL -> "Moderne Source Available" Proprietary -> "Moderne Proprietary" } + fun url() = when(this) { + Apache2 -> "https://www.apache.org/licenses/LICENSE-2.0" + MSAL -> "https://docs.moderne.io/licensing/moderne-source-available-license" + Proprietary -> "https://docs.moderne.io/licensing/overview" + } } fun getLicense(recipeOrigin: RecipeOrigin): License { diff --git a/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt b/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt index 4effbf8..e542bbd 100644 --- a/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt +++ b/src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt @@ -410,8 +410,9 @@ class RecipeMarkdownGenerator : Runnable { cliInstallGavs += "${origin.groupId}:${origin.artifactId}:${versionPlaceholder} " val repoLink = "[${origin.groupId}:${origin.artifactId}](${origin.githubUrl()})" val releaseLink = "[${origin.version}](${origin.githubUrl()}/releases/tag/v${origin.version})" - val license = getLicense(origin).toString() - writeln("| ${repoLink.padEnd(117)} | ${releaseLink.padEnd(90)} | ${license.padEnd(26)} |") + val license = getLicense(origin) + val licenseLink = "[${license.label()}](${license.url()})" + writeln("| ${repoLink.padEnd(117)} | ${releaseLink.padEnd(90)} | ${licenseLink} |") } //language=markdown writeln(