-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
110 lines (91 loc) · 2.72 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
buildscript {
dependencies {
classpath 'org.ysb33r.gradle:vfs-gradle-plugin:1.0'
classpath 'commons-httpclient:commons-httpclient:3.1'
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.8.1'
id 'com.github.jruby-gradle.base' version '1.5.0'
}
apply plugin: 'com.github.jruby-gradle.base'
apply plugin: 'org.ysb33r.vfs'
apply plugin: 'org.asciidoctor.convert'
ext {
deckjsVersion = 'master'
asciidoctorBackendVersion = 'master'
downloadDir = new File(buildDir,'download')
templateDir = new File(downloadDir,'templates')
deckjsDir = new File(downloadDir,'deck.js')
}
repositories {
jcenter()
}
dependencies {
gems 'rubygems:haml:4.0.7'
}
task download {
doLast {
mkdir downloadDir
vfs {
cp "zip:https://github.com/asciidoctor/asciidoctor-deck.js/archive/${asciidoctorBackendVersion}.zip!asciidoctor-deck.js-${asciidoctorBackendVersion}/templates",
templateDir, recursive:true, overwrite:true
cp "zip:https://github.com/imakewebthings/deck.js/archive/${deckjsVersion}.zip!deck.js-${deckjsVersion}",
deckjsDir, recursive:true, overwrite:true
}
}
}
download {
description "Download extra deckjs resources"
outputs.dir templateDir
outputs.dir deckjsDir
}
asciidoctorj {
version = '1.5.5'
}
asciidoctor {
dependsOn jrubyPrepare
sources {
include 'index.adoc'
}
resources {
from (sourceDir) {
include 'images/**'
}
from (downloadDir) {
include 'deck.js/**'
}
}
backends 'html5'
attributes \
'build-gradle': file('build.gradle'),
'sourcedir': file('src/docs/asciidoc'),
'endpoint-url': 'http://example.org',
'source-highlighter': 'coderay',
'imagesdir': './images',
'toc': 'left',
'icons': 'font',
'setanchors': '',
'idprefix': '',
'idseparator': '-',
'docinfo1': ''
options template_dirs : [new File(templateDir,'haml').absolutePath ]
dependsOn download
}
task copyOciBrandingImages(type: Copy) {
from "${rootProject.projectDir}/src/main/resources/images"
into "${rootProject.buildDir}/asciidoc/html5/images"
include "**/*.png"
}
task ociBranding {
dependsOn copyOciBrandingImages
doLast {
File cssFile = new File("${rootProject.projectDir}/src/main/resources/css/main.css")
assert cssFile.exists()
String css = cssFile.text
File f = new File("${rootProject.buildDir}/asciidoc/html5/index.html")
assert f.exists()
f.text = f.text.replaceAll('</head>', "<style text='type/css'>${css}</style></head>".toString())
}
}
asciidoctor.finalizedBy(ociBranding)