Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
3 posts
|
I use the asciidoctor-gradle plugin to create a deckjs based presentation.
However I also need ditaa for some diagrams which I cannot get to work. My main problem is that asciidoctor-diagram needs additional ruby gems and I do not know how to integrate them into the gradle build. My current approach is to download the asciidoctor-diagram gem using gradle from torquebox and then add it to the rubyRuntime class instance inside the gradle build process. I am pretty familiar with Java and gradle. However my Ruby knowledge is not sufficient to get this to work. Can someone please have a look at the following build.gradle and point me into the right direction? import java.lang.reflect.Field buildscript { repositories { maven { name 'Bintray Asciidoctor repo' url 'http://dl.bintray.com/content/aalmiray/asciidoctor' } maven { name 'Bintray JCenter' url 'http://jcenter.bintray.com' } mavenLocal() } dependencies { classpath 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.0' } } apply plugin: 'asciidoctor' repositories { maven { name 'rubygems-release' url 'http://rubygems-proxy.torquebox.org/releases' } maven { name 'rubygems-prerelease' url 'http://rubygems-proxy.torquebox.org/prereleases' } } configurations { // create a Configuration called "gems" and add it to the project’s ConfigurationsContainer: gems } dependencies { // Add dependencies to the gems-Configuration // I am not sure what other gems are needed... // gems 'rubygems:thread_safe:0.2.0@gem' // gems 'rubygems:haml:4.0.4@gem' // gems 'rubygems:open-uri-cached:0.0.5@gem' // gems 'rubygems:asciidoctor:1.5.0.preview3-SNAPSHOT@gem' // gems 'rubygems:coderay:1.1.0@gem' // gems 'rubygems:tilt:2.0.0@gem' // gems 'rubygems:erubis:2.7.0@gem' // gems 'rubygems:slim:2.0.2@gem' // gems 'rubygems:rjb:1.4.9@gem' gems 'rubygems:asciidoctor-diagram:1.1.5@gem' } import org.asciidoctor.Asciidoctor import org.asciidoctor.internal.JRubyAsciidoctor import org.jruby.Ruby import static org.asciidoctor.internal.JRubyAsciidoctor.*; // task that copies the needed gems from torquebox into the "build/gems" directory (this works!) File gemPath = new File(buildDir, 'gems') task provideGemFiles(type: Copy) { from configurations.gems into gemPath } asciidoctor { // this is really dirty: I have to access the rubyRuntime via reflection since it is protected... JRubyAsciidoctor jRubyAsciidoctor = (JRubyAsciidoctor) Asciidoctor.Factory.create() Field field = JRubyAsciidoctor.class.getDeclaredField('rubyRuntime') field.setAccessible(true) Ruby ruby = (Ruby) field.get(jRubyAsciidoctor) ruby.instanceConfig.setLoadPaths([gemPath.canonicalPath]) ruby.evalScriptlet("require 'rubygems‘") // the following require statement does not work since Ruby does not find the asciidoctor-diagram gem ruby.evalScriptlet("require 'asciidoctor-diagram'") asciidoctor = jRubyAsciidoctor sourceDir = file('asciidoc') outputDir = buildDir backend = 'deckjs' options = [ template_dir: 'asciidoctor-backends/haml', eruby : 'erubis', attributes : [ backend : 'deckjs', deckjs_theme: 'Web-2.0', deckjs_transition: 'fade', customjs: '', customcss: '', blank: '', goto: '', menu: '', navigation: '', status: '', toc: '', 'source-highlighter': 'highlightjs' ] ] } asciidoctor.dependsOn(provideGemFiles) task build(dependsOn: 'asciidoctor') |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
298 posts
|
Hi I am not sure that with version 0.7.0 (which relies on AsciidoctorJ 0.1.4) will work correctly, because extension API has been changed in Asciidoctor version 1.5.0 and I think that diagram extension us currently working with this new API.
In next weeks I am going to write about how to use diagrams extension with AsciidoctorJ, if it all works as expected, and with the proper update of Gradle plugin to AsciidoctorJ, then you will be able to run them in an easy way. Also keep in mind that currently version 1.5.0 of Asciidoctor is under development but I am pretty sure that in next weeks a new stable version will be released. Alex. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
3 posts
|
Hello Alex,
thank you for your quick response. However I cannot wait several weeks since the presentation must be finished before. I guess this means I cannot use the gradle-plugin... Where will you write your article on how to use diagrams with AsciidoctorJ? best regards, Oliver |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
298 posts
|
Probably on my blog www.lordofthejars.com but of course you still need asciidoctor 1.5.0. Normally when I write a presentation I use the Ruby implementation of asciidoctor, is this approach also works for you? You Can install asciidoctor1.5.0.preview7 and generate slides as well Enviat des del meu iPhone
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
3 posts
|
I want to integrate the whole build with gradle since the rest of the project is also build with it.
To circumvent the current limitation of the asciidoctor-gradle plugin I have created the following task in my build.gradle: task asciidoctor(type: Exec) { commandLine 'ruby', 'build.rb', '-B', 'asciidoc', '-b', 'deckjs', '-T', 'asciidoctor-backends/haml', '-a', 'imagesdir=images', '-a', "customjs=''", '-a', "customcss=''", '-a', "goto=''", '-a', "menu=''", '-a', "navigation=''", '-a', "status=''", '-a', "toc=''", '-a', 'source-highlighter=highlightjs', 'asciidoc/cvdb.adoc' }And I have created a build.rb file: #!/usr/bin/env ruby require 'rubygems' require 'bundler/setup' require 'asciidoctor' require 'asciidoctor/cli/options' require 'asciidoctor/cli/invoker' require 'asciidoctor-diagram' Asciidoctor::Cli::Invoker.new(*ARGV).invoke!This works even with the diagram plugin. Unfortunately source files and target files are now mixed up in my asciidoc folder. It would be nicer if all files that are needed to run the presentation would be generated and/or copied into the build folder. Will this be part of the next gradle-plugin version or is there already an option for the ruby api? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
298 posts
|
I think this will need to be a part of Gradle plugin, because for example Maven plugin implements this feature on its own.
But of course it can be talked with @mojavelinux to discuss if it can take part of the Ruby API as well. |
Free forum by Nabble | Edit this page |