11buildscript {
22 repositories {
3- jcenter()
43 mavenCentral()
4+ maven { url " https://plugins.gradle.org/m2/" }
55 }
66 dependencies {
7- classpath " org.asciidoctor:asciidoctor-gradle -plugin:${ project.asciiDoctorGradlePluginVersion } "
7+ classpath " org.asciidoctor:asciidoctor-maven -plugin:${ project.asciiDoctorMavenPluginVersion } "
88 classpath " org.asciidoctor:asciidoctorj-pdf:${ project.asciiDoctorJPdfVersion} "
99 classpath " org.ajoberstar:gradle-git:${ project.gradleGitVersion} "
10- classpath " com.bluepapa32:gradle-watch-plugin:${ project.gradleWatchPluginVersion} "
1110 classpath " org.kordamp.gradle:livereload-gradle-plugin:${ project.livereloadGradlePluginVersion} "
11+ classpath " org.asciidoctor:asciidoctor-gradle-jvm:${ project.asciidoctorGradleJvm} "
12+ classpath " org.asciidoctor:asciidoctor-gradle-base:${ project.asciidoctorGradleBase} "
1213 }
1314}
1415
15- apply plugin : ' org.asciidoctor.convert'
16+ apply plugin : ' org.asciidoctor.jvm. convert'
1617apply plugin : ' org.ajoberstar.github-pages'
17- apply plugin : ' com.bluepapa32.watch'
1818apply plugin : ' org.kordamp.gradle.livereload'
1919apply plugin : ' java'
2020apply plugin : ' idea'
21+ apply plugin : ' org.asciidoctor.base'
2122
2223repositories {
23- jcenter()
2424 mavenCentral()
2525 maven {
2626 url " https://oss.sonatype.org/content/repositories/snapshots"
@@ -51,19 +51,22 @@ asciidoctor {
5151 sources {
5252 include ' index.adoc'
5353 }
54- backends = [' html5' ]
54+ outputOptions {
55+ backends = [' html5' ]
56+ }
57+ outputDir = file(" $buildDir /docs/asciidoc" )
5558 resources {
5659 from(sourceDir) {
5760 include ' images/**'
5861 }
5962 }
6063}
6164
62- tasks. withType(Copy ) {
65+ tasks. withType(Copy ). configureEach {
6366 eachFile { println it. file }
6467}
6568
66- task copyCNAME ( type : Copy ) {
69+ tasks . register( ' copyCNAME ' , Copy ) {
6770 from ' CNAME'
6871 into file(asciidoctor. outputDir. path + ' /html5' )
6972}
@@ -86,13 +89,23 @@ githubPages {
8689 }
8790}
8891
89- watch {
90- asciidoc {
91- files fileTree(' src/docs/asciidoc' )
92- tasks ' asciidoctor'
92+ liveReload {
93+ docRoot asciidoctor. outputDir. canonicalPath
94+ }
95+
96+ tasks. register(' watchAsciidoc' ) {
97+ doLast {
98+ tasks. asciidoctor. execute()
9399 }
94100}
95101
96- liveReload {
97- docRoot asciidoctor. outputDir. canonicalPath
102+ tasks. register(' watch' ) {
103+ doLast {
104+ fileTree(' src/docs/asciidoc' ). visit { fileDetails ->
105+ if (fileDetails. file. isFile()) {
106+ println " Watching file: ${ fileDetails.file} "
107+ }
108+ }
109+ tasks. watchAsciidoc. execute()
110+ }
98111}
0 commit comments