-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
89 lines (81 loc) · 2.59 KB
/
build.gradle
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
buildscript {
repositories {
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-jvm:2.2.0'
classpath 'org.ajoberstar:gradle-git-publish:2.1.1'
}
}
import org.asciidoctor.gradle.AsciidoctorTask
// TODO: Somehow create index.html file based on subprojects, linking to each presentation
apply plugin: 'org.ajoberstar.git-publish'
gitPublish {
repoUri = '[email protected]:pvdissel/talks.git'
branch = 'gh-pages'
repoDir = file("$buildDir/gitPublish")
contents {
subprojects.each { p ->
// TODO: Use output path from 'presentation' task, instead of hardcoding
from("${p.buildDir}/asciidoc/html5/") {
rename('presentation.html', 'index.html')
into p.name
}
}
def tmpDir = file("${buildDir}/tmp")
tmpDir.mkdirs()
def index = File.createTempFile('index', '.html', tmpDir)
index.createNewFile()
index.withWriter { c ->
c.writeLine '<html>'
c.writeLine '<body>'
c.writeLine '<h1>Talks</h1>'
c.writeLine '<dl>'
subprojects.each { p ->
def (date, title, location) = p.name.split('_')
c.writeLine """<dt><a href="${p.name}/">${title.capitalize()}</a></dt>"""
c.writeLine "<dd>${date} at ${location}</dd>"
}
c.writeLine '</dl>'
c.writeLine '</body>'
c.writeLine '</html>'
}
from(index) {
rename(/.*/, 'index.html')
}
}
commitMessage = 'Updating talks'
}
gradle.afterProject { project, projectState ->
project.tasks.findAll { it.name == 'presentation' }.each {
rootProject.gitPublishPush.dependsOn it
}
}
subprojects {
repositories.jcenter()
apply plugin: "org.asciidoctor.convert"
ext.backendPath = "${rootDir}/.backends/reveal.js/v3.8.0"
task presentation(type: AsciidoctorTask) {
sourceDir = file('src/docs/asciidoc')
sources {
include 'presentation.adoc'
}
resources {
from("${backendPath}/resources") {
include '**/*'
}
from("${sourceDir}/../resources") {
include '**/*'
}
}
logDocuments = true
options = [
template_engine: 'slim',
template_dirs : ["${backendPath}/templates/asciidoctor-reveal.js-2.0.0/templates" as String]
]
}
}