From d38965baef1e6ab0c3e39a0e80b9fd26fd2329ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Herna=CC=81ndez?= Date: Tue, 22 Nov 2022 09:23:29 +0100 Subject: [PATCH] Add `organization` SBT setting as `ORGANIZATION` mdoc variable --- .../alejandrohdezma/sbt/github/mdoc/SbtGithubMdocPlugin.scala | 1 + .../src/sbt-test/sbt-github-mdoc/simple/DOCS.md | 2 ++ .../src/sbt-test/sbt-github-mdoc/simple/build.sbt | 1 + .../src/sbt-test/sbt-github-mdoc/simple/docs/DOCS.md | 2 ++ site/docs/sbt-mdoc.md | 3 ++- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/sbt-github-mdoc/src/main/scala/com/alejandrohdezma/sbt/github/mdoc/SbtGithubMdocPlugin.scala b/modules/sbt-github-mdoc/src/main/scala/com/alejandrohdezma/sbt/github/mdoc/SbtGithubMdocPlugin.scala index 8817129f..abcc26c7 100644 --- a/modules/sbt-github-mdoc/src/main/scala/com/alejandrohdezma/sbt/github/mdoc/SbtGithubMdocPlugin.scala +++ b/modules/sbt-github-mdoc/src/main/scala/com/alejandrohdezma/sbt/github/mdoc/SbtGithubMdocPlugin.scala @@ -87,6 +87,7 @@ object SbtGithubMdocPlugin extends AutoPlugin { displayName := SbtGithubPlugin.info.value._2, removeVersionTimestampInMdoc := true, mdocVariables ++= Map( + "ORGANIZATION" -> organization.value, "NAME" -> displayName.value, "REPO" -> repository.value.map(_.name).getOrElse(""), "DEFAULT_BRANCH" -> repository.value.map(_.defaultBranch).getOrElse(""), diff --git a/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/DOCS.md b/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/DOCS.md index bf3a31a0..4a0dbf25 100644 --- a/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/DOCS.md +++ b/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/DOCS.md @@ -1,5 +1,7 @@ sbt-github +my.org + user1/repo name diff --git a/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/build.sbt b/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/build.sbt index 26133144..359c02fb 100644 --- a/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/build.sbt +++ b/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/build.sbt @@ -1,6 +1,7 @@ ThisBuild / scmInfo := Some( ScmInfo(url("http://example.com"), "scm:git:https://github.com/alejandrohdezma/sbt-github.git") ) +ThisBuild / organization := "my.org" ThisBuild / githubEnabled := true ThisBuild / githubAuthToken := Some(AuthToken("1234")) ThisBuild / githubApiEntryPoint := { diff --git a/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/docs/DOCS.md b/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/docs/DOCS.md index fb8d2e55..ec0d5c7b 100644 --- a/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/docs/DOCS.md +++ b/modules/sbt-github-mdoc/src/sbt-test/sbt-github-mdoc/simple/docs/DOCS.md @@ -1,5 +1,7 @@ @NAME@ +@ORGANIZATION@ + @REPO@ @DEFAULT_BRANCH@ diff --git a/site/docs/sbt-mdoc.md b/site/docs/sbt-mdoc.md index fe9aa1f4..91e1f312 100644 --- a/site/docs/sbt-mdoc.md +++ b/site/docs/sbt-mdoc.md @@ -18,13 +18,14 @@ The plugin provides the following `mdocVariables`: | **COLLABORATORS** | Set to the value of the `collaborators` setting, containing the list of repository collaborators in markdown format | | **COLLABORATORS_TABLE** | Set to the value of the `collaborators` setting, containing the list of repository collaborators as a markdown table | | **NAME** | Set to the value of `displayName`. Defaults to repository's name. | +| **ORGANIZATION** | Set to the value of `organization` | | **DESCRIPTION** | Set to the value of `description` | | **LICENSE** | Set to the license's name | | **ORG_NAME** | Set to the value of `organizationName` setting (Github's organization name or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) | | **ORG_EMAIL** | Set to the value of `organizationEmail` setting (Github's organization email, or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) | | **ORG_URL** | Set to the value of `organizationHomepage` setting (Github's organization homepage or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) | | **REPO** | Set to the repository's path: "owner/repo" | -| **DEFAULT_BRANCH** | Set to the repository's default branch | +| **DEFAULT_BRANCH** | Set to the repository's default branch | | **START_YEAR** | Set to the value of the `startYear` setting | | **YEAR_RANGE** | Set to the value of the `yearRange` setting | | **COPYRIGHT_OWNER** | Set to the value of `ORG_NAME ` if `ORG_URL` is present or just `ORG_NAME` in case `ORG_URL` is empty |