Asciidoctor-java-integration Main class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Asciidoctor-java-integration Main class

asotobu
Asciidoctor 0.1.3 has been released with a little secret inside, it contains a Main class so you can run Asciidoctor from command line, although this feature is developed and tested, it is not officially released because first I would like to discuss how to package this feature. We have got (from my point of view) two ways to bundle this package:

* Creating a Maven profile so when is enabled a zip file is created with jar, dependencies and a bat/sh file.
* Splitting project into two modules, the first one which is the AJI itself and the second one which is the CLI classes and configuration.

At this stage of development we can choose the first one without much problem, the project is small enough to be manageable with only one project, and postpone this split later only if it is required.

WDYT?
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor-java-integration Main class

mojavelinux
Administrator
I would postpone the split and just create a distribution zip. That way, we can collect some feedback and ideas about this commandline tool and perhaps then we discover a third way of organizing the project.

Btw, I gave this a try and it works great. Here's the command I used to run it:

java -cp jruby-complete-1.7.4.jar:jcommander-1.30.jar:asciidoctor-java-integration-0.1.3.jar org.asciidoctor.cli.AsciidoctorInvoker sample.adoc

The "java -jar" command cannot be used until the Asciidoctor Java integration jar includes a MANIFEST.MF that declares the main class, which will be part of making the distribution.

Great work Alex!

-Dan



On Mon, Jun 3, 2013 at 12:36 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Asciidoctor 0.1.3 has been released with a little secret inside, it contains a Main class so you can run Asciidoctor from command line, although this feature is developed and tested, it is not officially released because first I would like to discuss how to package this feature. We have got (from my point of view) two ways to bundle this package:

* Creating a Maven profile so when is enabled a zip file is created with jar, dependencies and a bat/sh file.
* Splitting project into two modules, the first one which is the AJI itself and the second one which is the CLI classes and configuration.

At this stage of development we can choose the first one without much problem, the project is small enough to be manageable with only one project, and postpone this split later only if it is required.

WDYT?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Asciidoctor-java-integration-Main-class-tp266.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor-java-integration Main class

asotobu
Thanks, yes I must create  MANIFEST with correct data, and a script file (sh and bat) so you don't have to use the large form java -jar <class> <options> but this will be for next version. The main reason why I couldn't release this feature as complete solution with this version is that I have a problem with jcommander. If you want to read AsciiDoc from standard input (by using - as input), jcommander thinks that you have missed a parameter and throws an exception. So for example:

java -cp jruby-complete-1.7.4.jar:jcommander-1.30.jar:asciidoctor-java-integration-0.1.3.jar org.asciidoctor.cli.AsciidoctorInvoker - 

which should let users to write into console in AsciiDoc format, does not work because of a parse exception. Maybe we could change this character in Java part, but sincerely I would prefer not to do it. Also with Jason we wrote a tweet to Cédric but no response yet. The other alternative is to preparse command arguments, but then the code it is a bit clunky because all parameters are parsed with jcommander except the last one.

Well at least we have a way to continue so next version will contain a zip file with required files to be executed from command line.

Alex.