-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathtest.sbt
More file actions
29 lines (23 loc) · 1.05 KB
/
test.sbt
File metadata and controls
29 lines (23 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import play.twirl.sbt.Import.TwirlKeys
headerLicense := Some(HeaderLicense.ALv2("2015", "Heiko Seeberger"))
headerMappings := Map(HeaderFileType("html") -> HeaderCommentStyle.TwirlStyleFramedBlockComment)
unmanagedSources.in(Compile, headerCreate) ++= sources.in(Compile, TwirlKeys.compileTemplates).value
val checkFileContents = taskKey[Unit]("Verify file contents match expected contents")
checkFileContents := {
checkFile("views/index.scala.html")
checkFile("views/main.scala.html")
def checkFile(name: String) = {
val actualPath = (scalaSource.in(Compile).value / name).toString
val expectedPath = (scalaSource.in(Compile).value / (name + "_expected")).toString
val actual = scala.io.Source.fromFile(actualPath).mkString
val expected = scala.io.Source.fromFile(expectedPath).mkString
if (actual != expected) sys.error(
s"""|Actual file contents do not match expected file contents!
| expected: $expectedPath
|$expected
|
| actual: $actualPath
|$actual
|""".stripMargin)
}
}