Sha256: 9c6390db7410348f7075adb8655d2647ea60e0ae37e96f4878fcb155b849dddb

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 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 =
    LocalFile.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

2 entries across 2 versions & 1 rubygems

Version Path
s3_website_monadic-0.0.31 src/main/scala/s3/website/model/ssg.scala
s3_website_monadic-0.0.30 src/main/scala/s3/website/model/ssg.scala