forked from pvdissel/talks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
91 lines (83 loc) · 2.66 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
90
91
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
classpath 'com.github.jruby-gradle:jruby-gradle-plugin:0.1.12'
classpath 'org.ajoberstar:gradle-git:1.1.0'
}
}
import org.asciidoctor.gradle.AsciidoctorTask
// TODO: Somehow create index.html file based on subprojects, linking to each presentation
apply plugin: "org.ajoberstar.github-pages"
githubPages {
repoUri = '[email protected]:pvdissel/talks.git'
pages {
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')
}
}
}
gradle.afterProject { project, projectState ->
project.tasks.findAll { it.name == 'presentation' }.each {
//rootProject.prepareGhPages.dependsOn it
rootProject.publishGhPages.dependsOn it
}
}
subprojects {
repositories.jcenter()
apply plugin: "org.asciidoctor.gradle.asciidoctor"
asciidoctorj {
version = '1.5.2'
}
ext.backendPath = "${rootDir}/.backends/reveal.js"
task presentation(type: AsciidoctorTask) {
classpath = project.configurations.asciidoctor
sourceDir = file('src/docs/asciidoc')
sources {
include 'presentation.adoc'
}
resources {
from("${backendPath}/resources") {
include '**/*'
}
from("${sourceDir}/../resources") {
include '**/*'
}
}
backends = ['html5']
requires = ['slim', 'tilt', 'thread_safe']
logDocuments = true
options = [
template_engine: 'slim',
template_dirs : ["${backendPath}/templates"]
]
}
}