Skip to content

Commit

Permalink
Removes tut
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpedromoreno committed Dec 23, 2020
1 parent 7cdf102 commit c126f28
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 122 deletions.
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ lazy val documentation = project
.enablePlugins(MdocPlugin)

lazy val pluginSettings: Seq[Def.Setting[_]] = Seq(
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13"),
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13"),
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3"),
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1"),
Expand Down
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.9.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.9.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.9.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.14")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
39 changes: 4 additions & 35 deletions src/main/scala/microsites/MicrositeKeys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import sbt.Keys._
import sbt._
import sbt.complete.DefaultParsers.OptNotSpace
import sbt.io.{IO => FIO}
import tut.TutPlugin.autoImport._

import scala.concurrent.ExecutionContext
import scala.sys.process._
Expand All @@ -52,10 +51,6 @@ trait MicrositeKeys {
final case object GHPagesPlugin extends PushWith("ghPagesPlugin")
final case object GitHub4s extends PushWith("github4s")

sealed abstract class CompilingDocsTool extends Product with Serializable
final case object WithTut extends CompilingDocsTool
final case object WithMdoc extends CompilingDocsTool

object GitHostingService {
implicit def string2GitHostingService(name: String): GitHostingService = {
List(GitHub, GitLab, Bitbucket)
Expand All @@ -71,11 +66,8 @@ trait MicrositeKeys {
}

val makeMicrosite: TaskKey[Unit] = taskKey[Unit]("Main task to build a microsite")
val makeTut: TaskKey[Unit] = taskKey[Unit]("Sequential tasks to compile tut and move the result")
val makeMdoc: TaskKey[Unit] =
taskKey[Unit]("Sequential tasks to compile mdoc and move the result")
val makeDocs: TaskKey[Unit] =
taskKey[Unit]("Dynamic task that will evaluate makeTut or makeMdoc depending on setting")
val createMicrositeVersions: TaskKey[Unit] =
taskKey[Unit](
"Task to create the different microsites going through the list specified in the settings"
Expand All @@ -102,8 +94,6 @@ trait MicrositeKeys {
val microsite: TaskKey[Seq[File]] = taskKey[Seq[File]]("Create microsite files")
val micrositeMakeExtraMdFiles: TaskKey[File] =
taskKey[File]("Create microsite extra md files")
val micrositeTutExtraMdFiles: TaskKey[Seq[File]] =
taskKey[Seq[File]]("Run tut for extra microsite md files")
val micrositeName: SettingKey[String] = settingKey[String]("Microsite name")
val micrositeDescription: SettingKey[String] = settingKey[String]("Microsite description")
val micrositeAuthor: SettingKey[String] = settingKey[String]("Microsite author")
Expand Down Expand Up @@ -156,7 +146,7 @@ trait MicrositeKeys {
)
val micrositeExtraMdFiles: SettingKey[Map[File, ExtraMdFileConfig]] =
settingKey[Map[File, ExtraMdFileConfig]](
"Optional. This key is useful when you want to include automatically markdown documents as a part of your microsite, and these files are located in different places from the tutSourceDirectory. The map key is related with the source file, the map value corresponds with the target relative file path and the document meta-information configuration. By default, the map is empty."
"Optional. This key is useful when you want to include automatically markdown documents as a part of your microsite, and these files are located in different places. The map key is related with the source file, the map value corresponds with the target relative file path and the document meta-information configuration. By default, the map is empty."
)
val micrositeExtraMdFilesOutput: SettingKey[File] = settingKey[File](
"Optional. Microsite output location for extra-md files. Default is resourceManaged + '/jekyll/extra_md'"
Expand Down Expand Up @@ -214,9 +204,6 @@ trait MicrositeKeys {
"Optional. Add a button in DocsLayout pages that links to the file in the repository."
)

val micrositeCompilingDocsTool =
settingKey[CompilingDocsTool]("Choose between compiling code snippets with tut or mdoc")

val micrositeTheme: SettingKey[String] = settingKey[String](
"Optional. 'light' by default. Set it to 'pattern' to generate the pattern theme design."
)
Expand Down Expand Up @@ -320,7 +307,7 @@ trait MicrositeAutoImportSettings extends MicrositeKeys {
"style" -> "compressed",
"sourcemap" -> "never"
),
"collections" -> Map("tut" -> Map("output" -> true))
"collections" -> Map("mdoc" -> Map("output" -> true))
)

val userCustomVariables = micrositeConfigYaml.value
Expand Down Expand Up @@ -401,28 +388,10 @@ trait MicrositeAutoImportSettings extends MicrositeKeys {
microsite := micrositeHelper.value
.createResources(resourceManagedDir = (resourceManaged in Compile).value),
micrositeMakeExtraMdFiles := micrositeHelper.value.buildAdditionalMd(),
micrositeTutExtraMdFiles := {
val r = (runner in Tut).value
val in = micrositeMakeExtraMdFiles.value
val out = tutTargetDirectory.value
val cp = (fullClasspath in Tut).value
val opts = (scalacOptions in Tut).value
val pOpts = tutPluginJars.value.map(f => "–Xplugin:" + f.getAbsolutePath)
val re = tutNameFilter.value.pattern.toString
_root_.tut.TutPlugin.tutOne(streams.value, r, in, out, cp, opts, pOpts, re).map(_._1)
},
makeTut :=
Def.sequential(tut, micrositeTutExtraMdFiles).value,
makeMdoc :=
Def.sequential(mdoc.toTask(""), micrositeMakeExtraMdFiles).value,
makeDocs := Def.taskDyn {
micrositeCompilingDocsTool.value match {
case WithTut => Def.sequential(makeTut)
case WithMdoc => Def.sequential(makeMdoc)
}
}.value,
makeMicrosite :=
Def.sequential(microsite, makeDocs, makeSite).value,
Def.sequential(microsite, makeMdoc, makeSite).value,
makeVersionsJson := {
"which git".! match {
case 0 => ()
Expand Down Expand Up @@ -478,7 +447,7 @@ trait MicrositeAutoImportSettings extends MicrositeKeys {
}
},
makeVersionedMicrosite :=
Def.sequential(microsite, makeVersionsJson, makeDocs, makeSite).value,
Def.sequential(microsite, makeVersionsJson, makeMdoc, makeSite).value,
makeMultiversionMicrosite :=
Def
.sequential(createMicrositeVersions, clean, makeVersionedMicrosite, moveMicrositeVersions)
Expand Down
7 changes: 1 addition & 6 deletions src/main/scala/microsites/MicrositesPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import com.typesafe.sbt.site.SitePlugin.autoImport._
import sbt.Keys._
import sbt._
import sbt.plugins.IvyPlugin
import tut.TutPlugin
import tut.TutPlugin.autoImport._
import mdoc.MdocPlugin
import mdoc.MdocPlugin.autoImport._

Expand All @@ -38,7 +36,7 @@ object MicrositesPlugin extends AutoPlugin {
import com.typesafe.sbt.site.jekyll.JekyllPlugin.autoImport._

override def requires: Plugins =
IvyPlugin && MdocPlugin && TutPlugin && JekyllPlugin && GhpagesPlugin
IvyPlugin && MdocPlugin && JekyllPlugin && GhpagesPlugin

override def trigger: PluginTrigger = allRequirements

Expand All @@ -48,8 +46,6 @@ object MicrositesPlugin extends AutoPlugin {
Seq(
git.remoteRepo := s"git@github.com:${micrositeGithubOwner.value}/${micrositeGithubRepo.value}.git",
sourceDirectory in Jekyll := resourceManaged.value / "main" / "jekyll",
tutSourceDirectory := sourceDirectory.value / "main" / "tut",
tutTargetDirectory := resourceManaged.value / "main" / "jekyll",
mdocIn := baseDirectory.value / "docs",
mdocOut := resourceManaged.value / "main" / "jekyll"
)
Expand Down Expand Up @@ -126,7 +122,6 @@ object MicrositesPlugin extends AutoPlugin {
micrositeFooterText := Some(layouts.Layout.footer.toString),
micrositeEditButton := None,
micrositeGithubLinks := true,
micrositeCompilingDocsTool := WithMdoc,
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.jpeg" | "*.gif" | "*.js" | "*.swf" | "*.md" | "*.webm" | "*.ico" | "CNAME" | "*.yml" | "*.svg" | "*.json",
includeFilter in Jekyll := (includeFilter in makeSite).value || "LICENSE",
commands ++= Seq(publishMicrositeCommand),
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/microsites/change-default-paths/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ micrositeExtraMdFilesOutput := (target in Compile).value / "extra_md_override"
micrositeImgDirectory := (resourceDirectory in Compile).value / "images"
micrositeCssDirectory := (resourceDirectory in Compile).value / "styles"
micrositePluginsDirectory := (resourceDirectory in Compile).value / "plugins"
mdocIn := baseDirectory.in(ThisBuild).value / "src" / "main" / "tut"
mdocIn := baseDirectory.in(ThisBuild).value / "src" / "main" / "mdoc"
1 change: 0 additions & 1 deletion src/sbt-test/microsites/extra-md-files/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import microsites._
enablePlugins(MicrositesPlugin)
scalaVersion := sys.props("scala.version")

micrositeCompilingDocsTool := WithTut
micrositeExtraMdFiles := Map(
file("README.md") -> ExtraMdFileConfig(
"readme.md",
Expand Down
24 changes: 0 additions & 24 deletions src/sbt-test/microsites/tut-compile/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions src/sbt-test/microsites/tut-compile/build.sbt

This file was deleted.

2 changes: 0 additions & 2 deletions src/sbt-test/microsites/tut-compile/project/plugins.sbt

This file was deleted.

24 changes: 0 additions & 24 deletions src/sbt-test/microsites/tut-compile/src/main/tut/docs.md

This file was deleted.

14 changes: 0 additions & 14 deletions src/sbt-test/microsites/tut-compile/test

This file was deleted.

0 comments on commit c126f28

Please sign in to comment.