Skip to content

Commit 4c00ed3

Browse files
Removes tut (#527)
* Removes tut * Updates docs * Fixes scripted tests * Removes useless test
1 parent 7cdf102 commit 4c00ed3

File tree

25 files changed

+19
-216
lines changed

25 files changed

+19
-216
lines changed

build.sbt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ lazy val documentation = project
3636
.enablePlugins(MdocPlugin)
3737

3838
lazy val pluginSettings: Seq[Def.Setting[_]] = Seq(
39-
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13"),
4039
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13"),
4140
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3"),
4241
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1"),

microsite/docs/docs/build-the-microsite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Once you have written your documents, you can build the microsite running this s
1212
sbt> makeMicrosite
1313
```
1414

15-
Internally, it'll sequentially run other tasks including its own, [`tut`](https://github.com/tpolecat/tut) or [`mdoc`](https://scalameta.org/mdoc/), and `makeSite` ([sbt-site](https://github.com/sbt/sbt-site)) tasks.
15+
Internally, it'll sequentially run other tasks including its own, [`mdoc`](https://scalameta.org/mdoc/), and `makeSite` ([sbt-site](https://github.com/sbt/sbt-site)) tasks.
1616

1717

1818
# Multiversion support

microsite/docs/docs/getting-started.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,4 @@ enablePlugins(MicrositesPlugin)
5757

5858
# Write your documentation `.md` files
5959

60-
Your docs can be placed wherever you want in your project since there are sbt settings to point to the sources of your microsite, however the plugin expects to find the sources where both [**tut**](https://github.com/tpolecat/tut) and [**mdoc**](https://github.com/scalameta/mdoc) have defined by default. They are:
61-
62-
- Tut: `src/main/tut/`
63-
- mdoc: `docs/`
60+
Your docs can be placed wherever you want in your project since there are sbt settings to point to the sources of your microsite, however the plugin expects to find the sources where [**mdoc**](https://github.com/scalameta/mdoc) have defined by default (`docs/`).

microsite/docs/docs/intro.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ The plugin provides basic free styles, css, and image resources by default. Ever
2525

2626
In order to create microsites, this plugin directly uses the following plugins and libraries:
2727

28-
* [tut-plugin](https://github.com/tpolecat/tut)
2928
* [sbt-mdoc](https://github.com/scalameta/mdoc)
3029
* [sbt-site](https://github.com/sbt/sbt-site)
3130
* [sbt-ghpages](https://github.com/sbt/sbt-ghpages)

microsite/docs/docs/layouts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ To be able to access the documentation, you have to configure `micrositeDocument
6767

6868
In order to change the default label description for the `micrositeDocumentationUrl` (the default value is `Documentation`), you have to change the `micrositeDocumentationLabelDescription`.
6969

70-
As an example, you can look at the sbt-microsites documentation at [GitHub](https://github.com/47deg/sbt-microsites/tree/master/docs/src/main/tut). We have several documentation files:
70+
As an example, you can look at the sbt-microsites documentation at [GitHub](https://github.com/47degrees/sbt-microsites/tree/master/microsite/docs). We have several documentation files:
7171

7272
- `build-the-microsite.md`
7373
- `customize.md`

microsite/docs/docs/settings.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ micrositeStaticDirectory := (resourceDirectory in Compile).value / "site" / "mys
260260

261261
The directory will be copied as-is, but no process will be applied to any file on it. So the responsibility of loading/linking/using them on a layout is yours. Also, see the `includeFilter in makeSite` config setting for the allowed file types that will be copied.
262262

263-
- `micrositeExtraMdFiles`: This setting can be handy if you want to include additional markdown files in your site, and these files are not located in the same place in your `mdoc` or `tut` directory. By default, the setting is set up as an empty map. You can override it in this way:
263+
- `micrositeExtraMdFiles`: This setting can be handy if you want to include additional markdown files in your site, and these files are not located in the same place in your `mdoc` directory. By default, the setting is set up as an empty map. You can override it in this way:
264264

265265
```scala
266266
micrositeExtraMdFiles := Map(
@@ -278,7 +278,7 @@ micrositeExtraMdFiles := Map(
278278

279279
Each file (the map key) can be related to a specific configuration through the `ExtraMdFileConfig` case class. This class allows you to specify three additional configurations:
280280

281-
1. The target file name. The plugin will copy the file, and it will put it in tut directory each time you build the microsite. Therefore, you might want to include this auto-copied file in the list of ignored files at the `.gitignore` file.
281+
1. The target file name. The plugin will copy the file, and it will put it in mdoc directory each time you build the microsite. Therefore, you might want to include this auto-copied file in the list of ignored files at the `.gitignore` file.
282282
2. Jekyll `layout` property.
283283
3. Other custom Jekyll properties that you might want to include in your document. A good point to highlight here is that through the `permalink` property you can control the place where `Jekyll` is going to move your extra file. The value of this property prevails over the folder where the file is copied.
284284

@@ -367,16 +367,9 @@ repository URL, and should include the dynamic property `{% raw %}{{page.path}}{
367367
compiles the site. **The strings are passed in unsanitized to the templating engine.**
368368

369369
```scala
370-
{% raw %}micrositeEditButton := Some(MicrositeEditButton("Improve this Page", "/edit/master/docs/src/main/tut/{{ page.path }}")){% endraw %}
370+
{% raw %}micrositeEditButton := Some(MicrositeEditButton("Improve this Page", "/edit/master/docs/{{ page.path }}")){% endraw %}
371371
```
372372

373-
- `micrositeCompilingDocsTool`: Choose between compiling code snippets with [**tut**](https://github.com/tpolecat/tut) or [**mdoc**](https://github.com/scalameta/mdoc). By default, it's set to `WithMdoc` since the sbt-microsites 1.0.0 release. But you could use `WithTut` if you want to preserve the compatibility with previous versions of your markdown files.
374-
375-
```scala
376-
micrositeCompilingDocsTool := WithMdoc
377-
```
378-
If you are interested in learning where to place the markdown files according to the compilation tool chosen, please take a look at the [Typechecked Snippets]({% link docs/typechecked-snippets.md %}) section.
379-
380373
- `includeFilter in makeSite`: Restrict the type of files that are included during the microsite build. The default value is `"*.html" | "*.css" | "*.png" | "*.jpg" | "*.jpeg" | "*.gif" | "*.js" | "*.swf" | "*.md" | "*.webm" | "*.ico" | "CNAME" | "*.yml" | "*.svg" | "*.json"` but you can override it like this:
381374

382375
```scala

microsite/docs/docs/typechecked-snippets.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,18 @@ permalink: docs/typechecked-snippets/
66

77
# Typechecked Snippets
88

9-
As has been mentioned a couple of times throughout this tutorial, this plugin supports the compilation of Scala code written in markdown files. This process is now being delegated on two different sbt plugins: [**tut**](https://github.com/tpolecat/tut) and [**mdoc**](https://github.com/scalameta/mdoc).
10-
11-
## Tut
12-
13-
[tut](https://github.com/tpolecat/tut) has been deprecated, please switch to mdoc (see next section). If for some reason you want to keep using it, here there are some recommendations:
14-
15-
- Set this property accordingly: `micrositeCompilingDocsTool := WithTut`.
16-
- Add your markdown files in this path by default: `src/main/tut/`.
17-
- If you want to place your documments in a different path, just set the sbt property `tutSourceDirectory := your-path` being _your-path_ a `SettingKey[File]`.
18-
- Mark the snippets that you want to compile, following this convention: **_```tut_** or any of its [modifiers](https://tpolecat.github.io/tut/modifiers.html)
19-
9+
As has been mentioned a couple of times throughout this tutorial, this plugin supports the compilation of Scala code written in markdown files. This process is now being delegated on [**mdoc**](https://github.com/scalameta/mdoc).
2010

2111
## mdoc
2212

2313
`mdoc` is the option by default, so no special action is required from your side. See the scalameta site for more information [here](https://scalameta.org/mdoc/). Here is some advice for using this in your microsite:
2414

2515
- Add your markdown files in this path by default: `docs/`.
26-
- By default, the setting `micrositeCompilingDocsTool` will be `WithMdoc`, so no action would be required.
2716
- If you want to place your documents in a different path, just set the sbt property `mdocIn := your-path` being _your-path_ a `SettingKey[File]`.
2817
- Mark the snippets that you want to compile, following this convention: **_```scala mdoc_** or any of its [modifiers](https://scalameta.org/mdoc/docs/modifiers.html)
2918

3019
## Migrating from tut to mdoc
3120

32-
You can migrate your microsite from _tut_ to _mdoc_ in 3 smooth steps:
33-
34-
- Set this property accordingly: `micrositeCompilingDocsTool := WithMdoc`
35-
- Set the property `mdocIn := tutSourceDirectory`, thus we are setting the source for mdoc as it used to be for tut.
36-
- Replace **_tut_** with **_mdoc_** in the snippets modifiers following this [migration guide](https://scalameta.org/mdoc/docs/tut.html).
21+
If your project is still based on `tut`, you can migrate it from _tut_ to _mdoc_ can follow this [migration guide](https://scalameta.org/mdoc/docs/tut.html).
3722

3823
There is also a [script](https://github.com/scalameta/mdoc/blob/5c732bc48eb88b8a416e5c61e945eac6d410b27b/bin/migrate-tut.sh) that does the replacement for you.

project/plugins.sbt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.9.0")
55
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.9.0")
66
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.9.0")
77
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
8-
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13")
98
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.14")
109
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
1110
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")

src/main/scala/microsites/MicrositeKeys.scala

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import sbt.Keys._
3535
import sbt._
3636
import sbt.complete.DefaultParsers.OptNotSpace
3737
import sbt.io.{IO => FIO}
38-
import tut.TutPlugin.autoImport._
3938

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

55-
sealed abstract class CompilingDocsTool extends Product with Serializable
56-
final case object WithTut extends CompilingDocsTool
57-
final case object WithMdoc extends CompilingDocsTool
58-
5954
object GitHostingService {
6055
implicit def string2GitHostingService(name: String): GitHostingService = {
6156
List(GitHub, GitLab, Bitbucket)
@@ -71,11 +66,8 @@ trait MicrositeKeys {
7166
}
7267

7368
val makeMicrosite: TaskKey[Unit] = taskKey[Unit]("Main task to build a microsite")
74-
val makeTut: TaskKey[Unit] = taskKey[Unit]("Sequential tasks to compile tut and move the result")
7569
val makeMdoc: TaskKey[Unit] =
7670
taskKey[Unit]("Sequential tasks to compile mdoc and move the result")
77-
val makeDocs: TaskKey[Unit] =
78-
taskKey[Unit]("Dynamic task that will evaluate makeTut or makeMdoc depending on setting")
7971
val createMicrositeVersions: TaskKey[Unit] =
8072
taskKey[Unit](
8173
"Task to create the different microsites going through the list specified in the settings"
@@ -102,8 +94,6 @@ trait MicrositeKeys {
10294
val microsite: TaskKey[Seq[File]] = taskKey[Seq[File]]("Create microsite files")
10395
val micrositeMakeExtraMdFiles: TaskKey[File] =
10496
taskKey[File]("Create microsite extra md files")
105-
val micrositeTutExtraMdFiles: TaskKey[Seq[File]] =
106-
taskKey[Seq[File]]("Run tut for extra microsite md files")
10797
val micrositeName: SettingKey[String] = settingKey[String]("Microsite name")
10898
val micrositeDescription: SettingKey[String] = settingKey[String]("Microsite description")
10999
val micrositeAuthor: SettingKey[String] = settingKey[String]("Microsite author")
@@ -156,7 +146,7 @@ trait MicrositeKeys {
156146
)
157147
val micrositeExtraMdFiles: SettingKey[Map[File, ExtraMdFileConfig]] =
158148
settingKey[Map[File, ExtraMdFileConfig]](
159-
"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."
149+
"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."
160150
)
161151
val micrositeExtraMdFilesOutput: SettingKey[File] = settingKey[File](
162152
"Optional. Microsite output location for extra-md files. Default is resourceManaged + '/jekyll/extra_md'"
@@ -214,9 +204,6 @@ trait MicrositeKeys {
214204
"Optional. Add a button in DocsLayout pages that links to the file in the repository."
215205
)
216206

217-
val micrositeCompilingDocsTool =
218-
settingKey[CompilingDocsTool]("Choose between compiling code snippets with tut or mdoc")
219-
220207
val micrositeTheme: SettingKey[String] = settingKey[String](
221208
"Optional. 'light' by default. Set it to 'pattern' to generate the pattern theme design."
222209
)
@@ -320,7 +307,7 @@ trait MicrositeAutoImportSettings extends MicrositeKeys {
320307
"style" -> "compressed",
321308
"sourcemap" -> "never"
322309
),
323-
"collections" -> Map("tut" -> Map("output" -> true))
310+
"collections" -> Map("mdoc" -> Map("output" -> true))
324311
)
325312

326313
val userCustomVariables = micrositeConfigYaml.value
@@ -401,28 +388,10 @@ trait MicrositeAutoImportSettings extends MicrositeKeys {
401388
microsite := micrositeHelper.value
402389
.createResources(resourceManagedDir = (resourceManaged in Compile).value),
403390
micrositeMakeExtraMdFiles := micrositeHelper.value.buildAdditionalMd(),
404-
micrositeTutExtraMdFiles := {
405-
val r = (runner in Tut).value
406-
val in = micrositeMakeExtraMdFiles.value
407-
val out = tutTargetDirectory.value
408-
val cp = (fullClasspath in Tut).value
409-
val opts = (scalacOptions in Tut).value
410-
val pOpts = tutPluginJars.value.map(f => "–Xplugin:" + f.getAbsolutePath)
411-
val re = tutNameFilter.value.pattern.toString
412-
_root_.tut.TutPlugin.tutOne(streams.value, r, in, out, cp, opts, pOpts, re).map(_._1)
413-
},
414-
makeTut :=
415-
Def.sequential(tut, micrositeTutExtraMdFiles).value,
416391
makeMdoc :=
417392
Def.sequential(mdoc.toTask(""), micrositeMakeExtraMdFiles).value,
418-
makeDocs := Def.taskDyn {
419-
micrositeCompilingDocsTool.value match {
420-
case WithTut => Def.sequential(makeTut)
421-
case WithMdoc => Def.sequential(makeMdoc)
422-
}
423-
}.value,
424393
makeMicrosite :=
425-
Def.sequential(microsite, makeDocs, makeSite).value,
394+
Def.sequential(microsite, makeMdoc, makeSite).value,
426395
makeVersionsJson := {
427396
"which git".! match {
428397
case 0 => ()
@@ -478,7 +447,7 @@ trait MicrositeAutoImportSettings extends MicrositeKeys {
478447
}
479448
},
480449
makeVersionedMicrosite :=
481-
Def.sequential(microsite, makeVersionsJson, makeDocs, makeSite).value,
450+
Def.sequential(microsite, makeVersionsJson, makeMdoc, makeSite).value,
482451
makeMultiversionMicrosite :=
483452
Def
484453
.sequential(createMicrositeVersions, clean, makeVersionedMicrosite, moveMicrositeVersions)

src/main/scala/microsites/MicrositesPlugin.scala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import com.typesafe.sbt.site.SitePlugin.autoImport._
2323
import sbt.Keys._
2424
import sbt._
2525
import sbt.plugins.IvyPlugin
26-
import tut.TutPlugin
27-
import tut.TutPlugin.autoImport._
2826
import mdoc.MdocPlugin
2927
import mdoc.MdocPlugin.autoImport._
3028

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

4038
override def requires: Plugins =
41-
IvyPlugin && MdocPlugin && TutPlugin && JekyllPlugin && GhpagesPlugin
39+
IvyPlugin && MdocPlugin && JekyllPlugin && GhpagesPlugin
4240

4341
override def trigger: PluginTrigger = allRequirements
4442

@@ -48,8 +46,6 @@ object MicrositesPlugin extends AutoPlugin {
4846
Seq(
4947
git.remoteRepo := s"git@github.com:${micrositeGithubOwner.value}/${micrositeGithubRepo.value}.git",
5048
sourceDirectory in Jekyll := resourceManaged.value / "main" / "jekyll",
51-
tutSourceDirectory := sourceDirectory.value / "main" / "tut",
52-
tutTargetDirectory := resourceManaged.value / "main" / "jekyll",
5349
mdocIn := baseDirectory.value / "docs",
5450
mdocOut := resourceManaged.value / "main" / "jekyll"
5551
)
@@ -126,7 +122,6 @@ object MicrositesPlugin extends AutoPlugin {
126122
micrositeFooterText := Some(layouts.Layout.footer.toString),
127123
micrositeEditButton := None,
128124
micrositeGithubLinks := true,
129-
micrositeCompilingDocsTool := WithMdoc,
130125
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.jpeg" | "*.gif" | "*.js" | "*.swf" | "*.md" | "*.webm" | "*.ico" | "CNAME" | "*.yml" | "*.svg" | "*.json",
131126
includeFilter in Jekyll := (includeFilter in makeSite).value || "LICENSE",
132127
commands ++= Seq(publishMicrositeCommand),

0 commit comments

Comments
 (0)