Skip to content

Commit

Permalink
add javadoc badge. (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
khajavi authored Jan 5, 2023
1 parent fefc08a commit f5c1058
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

_ZIO SBT_ is an sbt plugin for ZIO projects. It provides high-level SBT utilities that simplify the development of ZIO applications.

[![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sbt/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-sbt-website_2.12/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sbt-website_2.12/) [![ZIO SBT](https://img.shields.io/github/stars/zio/zio-sbt?style=social)](https://github.com/zio/zio-sbt)
[![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sbt/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-sbt-website_2.12/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sbt-website_2.12/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-sbt-docs/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-sbt-docs) [![ZIO SBT](https://img.shields.io/github/stars/zio/zio-sbt?style=social)](https://github.com/zio/zio-sbt)

## Installation

Expand Down
3 changes: 2 additions & 1 deletion zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ object WebsitePlugin extends sbt.AutoPlugin {
WebsiteUtils.generateProjectBadges(
projectStage = badge.projectStage,
groupId = organization.value,
artifact = badge.artifact,
artifactId = badge.artifact,
docsArtifactId = moduleName.value,
githubUser = "zio",
githubRepo =
scmInfo.value.map(_.browseUrl.getPath.split('/').last).getOrElse("github repo not provided"),
Expand Down
16 changes: 12 additions & 4 deletions zio-sbt-website/src/main/scala/zio/sbt/WebsiteUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ object WebsiteUtils {
s"[![$projectName]($githubBadge)]($repoUrl)"
}

def javadocBadge(groupId: String, artifactId: String): String = {
val badge = s"https://javadoc.io/badge2/$groupId/$artifactId/javadoc.svg"
val javadocUrl = s"https://javadoc.io/doc/$groupId/$artifactId"
s"[![javadoc]($badge)]($javadocUrl)"
}

def discord =
"[![Chat on Discord!](https://img.shields.io/discord/629491597070827530?logo=discord)](https://discord.gg/2ccFBr4)"

Expand Down Expand Up @@ -95,18 +101,20 @@ object WebsiteUtils {
def generateProjectBadges(
projectStage: ProjectStage,
groupId: String,
artifact: String,
artifactId: String,
docsArtifactId: String,
githubUser: String,
githubRepo: String,
projectName: String
): String = {
val stage = projectStageBadge(projectStage)
val ci = ciBadge(githubUser, githubRepo)
val release = releaseBadge(groupId, artifact)
val snapshot = snapshotBadge(groupId, artifact)
val release = releaseBadge(groupId, artifactId)
val snapshot = snapshotBadge(groupId, artifactId)
val github = githubBadge(githubUser, githubRepo, projectName)
val javadoc = javadocBadge(groupId, docsArtifactId)

s"$stage $ci $release $snapshot $github"
s"$stage $ci $release $snapshot $javadoc $github"
}

def generateReadme(
Expand Down

0 comments on commit f5c1058

Please sign in to comment.