-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.sbt
43 lines (38 loc) · 1.28 KB
/
site.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import scala.sys.process.Process
// See: https://github.com/sbt/sbt-site
enablePlugins(PreprocessPlugin)
enablePlugins(SiteScaladocPlugin)
enablePlugins(GhpagesPlugin)
preprocessVars in Preprocess := Map(
"REPO" -> "gov.nasa.jpl.imce",
"ORG" -> "JPL-IMCE",
"SUBJECT" -> "jpl-imce",
"ORG_NAME" -> organizationName.value,
"DESC" -> description.value,
"PKG" -> moduleName.value,
"CONTRIBUTORS" -> {
val commit = Process("git rev-parse HEAD").lineStream.head
val p1 = Process(s"git shortlog -sne --no-merges $commit")
val p2 = Process(
Seq("sed",
"-e",
"""s|^\s*\([0-9][0-9]*\)\s*\(\w.*\w\)\s*<\([a-zA-Z].*\)>.*$|<tr><td align='right'>\1</td><td>\2</td><td>\3</td></tr>|"""))
val whoswho = p1 #| p2
whoswho.lineStream.mkString("\n")
},
"VERSION" -> {
git.gitCurrentTags.value match {
case Seq(tag) =>
s"""<a href="https://github.com/JPL-IMCE/${moduleName.value}/tree/$tag">$tag</a>"""
case _ =>
val v = version.value
git.gitHeadCommit.value.fold[String](v) { sha =>
if (git.gitUncommittedChanges.value)
v
else
s"""<a href="https://github.com/JPL-IMCE/${moduleName.value}/tree/$sha">$v</a>"""
}
}
}
)
target in preprocess := (target in makeSite).value