Skip to content

Commit

Permalink
Merge pull request #160 from vlovgr/docusaurus-windows
Browse files Browse the repository at this point in the history
Add initial Windows support for docusaurusPublishGhpages
  • Loading branch information
olafurpg authored Apr 4, 2019
2 parents fb5b697 + 7e1e106 commit 8730f45
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions mdoc-sbt/src/main/scala/mdoc/DocusaurusPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ object DocusaurusPlugin extends AutoPlugin {
|USE_SSH=true yarn publish-gh-pages
""".stripMargin

def installSshWindows: String =
"""|@echo off
|call yarn install
|set USE_SSH=true
|call yarn publish-gh-pages
""".stripMargin

override def projectSettings: Seq[Def.Setting[_]] = List(
aggregate.in(docusaurusPublishGhpages) := false,
aggregate.in(docusaurusCreateSite) := false,
Expand All @@ -85,8 +92,18 @@ object DocusaurusPlugin extends AutoPlugin {
),
docusaurusPublishGhpages := {
m.mdoc.toTask(" ").value
val tmp = Files.createTempFile("docusaurus", "install_ssh.sh")
Files.write(tmp, installSsh.getBytes())

val tmp =
if (scala.util.Properties.isWin) {
val tmp = Files.createTempFile("docusaurus", "install_ssh.bat")
Files.write(tmp, installSshWindows.getBytes())
tmp
} else {
val tmp = Files.createTempFile("docusaurus", "install_ssh.sh")
Files.write(tmp, installSsh.getBytes())
tmp
}

tmp.toFile.setExecutable(true)
Process(
tmp.toString,
Expand Down

0 comments on commit 8730f45

Please sign in to comment.