Sha256: 2431ccb2018d617784849ebb4f5c609b226272ae9287164569ad58b56c48e398

Contents?: true

Size: 945 Bytes

Versions: 26

Compression:

Stored size: 945 Bytes

Contents

package s3.website.model

import java.io.File
import s3.website.{ErrorOrFile, ErrorReport}

// ssg = static site generator
trait Ssg {
  def outputDirectory: String
}

object Ssg {
  val automaticallySupportedSiteGenerators = Jekyll :: Nanoc :: Nil

  val notFoundErrorReport =
    new ErrorReport {
      def reportMessage =
        """|Could not find a website in any of the pre-defined directories.
           |Specify the website location with the --site=path argument and try again.""".stripMargin
    }

  def findSiteDirectory(workingDirectory: File): ErrorOrFile =
    Files.recursiveListFiles(workingDirectory).find { file =>
      file.isDirectory && automaticallySupportedSiteGenerators.exists(_.outputDirectory == file.getName)
    }.fold(Left(notFoundErrorReport): ErrorOrFile)(Right(_))
}

case object Jekyll extends Ssg {
  def outputDirectory = "_site"
}

case object Nanoc extends Ssg {
  def outputDirectory = "public/output"
}

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
s3_website-2.1.16 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.15 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.14 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.13 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.12 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.11 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.10 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.9 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.8 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.7 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.6 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.5 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.4 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.3 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.2 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.1 src/main/scala/s3/website/model/ssg.scala
s3_website-2.1.0 src/main/scala/s3/website/model/ssg.scala
s3_website-2.0.1 src/main/scala/s3/website/model/ssg.scala
s3_website-2.0.0 src/main/scala/s3/website/model/ssg.scala
s3_website_monadic-0.0.38 src/main/scala/s3/website/model/ssg.scala