forked from NetLogo/Galapagos
-
Notifications
You must be signed in to change notification settings - Fork 2
/
lint.sbt
28 lines (24 loc) · 1.08 KB
/
lint.sbt
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
import com.typesafe.sbt.jse.{ SbtJsEngine, SbtJsTask }
import SbtJsEngine.autoImport.JsEngineKeys._
import SbtJsTask.autoImport.JsTaskKeys._
import com.typesafe.sbt.web.Import.WebKeys.{ nodeModuleDirectories, nodeModules }
import scala.concurrent.duration.{ FiniteDuration, SECONDS }
lazy val coffeelint = taskKey[Seq[File]]("lint coffeescript files in Galapagos")
def allCoffeeSources(directories: File*): Seq[File] =
(PathFinder(directories) ** "*.coffee").get
coffeelint := {
val coffeeSources = allCoffeeSources((sourceDirectory in Assets).value, (sourceDirectory in TestAssets).value)
val coffeelintConfig = baseDirectory.value / "coffeelint.json"
val allArgs = Seq("-f", coffeelintConfig.getPath) ++ coffeeSources.map(_.getPath)
SbtJsTask.executeJs(
state.value,
engineType.value,
command.value,
(nodeModuleDirectories in Assets).value.map(_.getPath),
(nodeModuleDirectories in Assets).value.last / "coffeelint" / "bin" / "coffeelint",
allArgs,
FiniteDuration(60, SECONDS)
)
coffeeSources
}
coffeelint <<= coffeelint dependsOn (nodeModules in Assets)