build.sc
changeset 33 fa0f19a74283
parent 32 2d14f02ba3bd
--- a/build.sc	Tue Nov 24 13:15:49 2020 +0100
+++ b/build.sc	Tue Dec 29 16:46:47 2020 +0100
@@ -13,6 +13,8 @@
 val akkaVer = "2.6.10"
 val akkaHttp = "10.2.1"
 
+val topLevelDir: Path = build.millSourcePath
+
 trait Common extends ScalaModule with PublishModule {
   val scalaVersion = scalaVer
 
@@ -135,9 +137,9 @@
           | import sqwl.cms.Category._
           | import sqwl.cms.Tag._
           | import sqwl.cms.Articles.article
-          | object `$aid` {
+          | object `$aid` extends ContentHolder {
           |   implicit val id = Articles.Id("$id")
-          |   twf("${p.toString}")
+          |   val content = twf("${p.toString}")
           | }
           |
           |/*
@@ -160,8 +162,10 @@
     write(dir / "main.scala",
       """
         | package sqwl.cms
-        | object Main extends Server {
-        |   override def content: iContent = Content
+        | import java.nio.file.Paths
+        | object Main extends Server with config {
+        |   override def content: iContent =
+        |     new Content(Paths.get(cms.root).toAbsolutePath)
         | }
       """.stripMargin)
 
@@ -193,20 +197,6 @@
     T.sources{ millSourcePath / up / 'example / 'content }
 }
 
-object production extends Content {
-  def contentSources: Sources =
-    T.sources{ millSourcePath / up / 'production / 'content }
-
-  def hgProdId: Input[String] = T.input {
-    os.proc("hg", "id", "-i", "--cwd", "production").call().out.trim
-  }
-
-  override def assemblyName: Target[String] = T{
-    s"${super.assemblyName()}-${hgProdId()}"
-  }
-}
-
-
 object js extends Common with ScalaJSModule {
   def scalaJSVersion: Target[String] = scalaJsVer
 }