Skip to content

Commit

Permalink
Link to licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Jan 8, 2025
1 parent f6c5788 commit ce8bf06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/main/kotlin/org/openrewrite/Licenses.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/org/openrewrite/RecipeMarkdownGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ce8bf06

Please sign in to comment.