asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
149 stars 50 forks source link

Unable to install recent version of asciidoctor-kroki in a maven build #367

Closed Riduidel closed 2 years ago

Riduidel commented 2 years ago

I'm using asciidoctor-kroki to write my diagrams for my conferences

Since asciidoctor-kroki is available as a ruby gem, I have to use torquebox maven plugin to install asciidoctor-kroki.

So I have this dependency definition

        <dependency>
            <groupId>rubygems</groupId>
            <artifactId>asciidoctor-kroki</artifactId>
            <version>0.17.0</version>
            <type>gem</type>
            <!-- Avoid downloading gems included in AsciidoctorJ -->
            <exclusions>
                <exclusion>
                    <groupId>rubygems</groupId>
                    <artifactId>asciidoctor</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>rubygems</groupId>
                    <artifactId>thread_safe</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>rubygems</groupId>
                    <artifactId>concurrent-ruby</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

And this configuration for the gem-maven-plugin

            <plugin>
                <groupId>de.saumya.mojo</groupId>
                <artifactId>gem-maven-plugin</artifactId>
                <version>2.0.1</version>
                <configuration>
                    <gemHome>${project.build.directory}/gems</gemHome>
                    <gemPath>${project.build.directory}/gems</gemPath>
                </configuration>
                <executions>
                    <!-- Install required gems in target directory -->
                    <execution>
                        <id>install-gems</id>
                        <goals>
                            <goal>initialize</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
            </plugin>

Unfortunatly, my build always fails with this error

[INFO] --- gem-maven-plugin:2.0.1:initialize (install-gems) @ conferences ---
[WARNING] ERROR:  While executing gem ... (ArgumentError)
    " html, b" is not an octal string

I've started a small debug session, revealing that gem-maven-plugin in fact invokes the Java executable

load('jar:file:C:\Users\nicolas-delsaux\.m2\repository\org\jruby\jruby-complete\9.2.19.0\jruby-complete-9.2.19.0.jar!/META-INF/jruby.home/bin/gem') install --ignore-dependencies --no-user-install --no-verbose --no-document C:\Users\nicolas-delsaux\.m2\repository\rubygems\asciidoctor-kroki\0.17.0\asciidoctor-kroki-0.17.0.gem --bindir C:\Users\nicolas-delsaux\Documents\Zenika\conferences\target\gems\bin

Do you have ay idea how I could fix that ?

ggrossetie commented 2 years ago

I don't really know as I've never encountered this error... 🤔

It seems related to rubygems, I found a similar issue (with the same error message): https://github.com/rubygems/rubygems/issues/3050 (not sure if it's related or not).

Do you know when this issue appeared? (As you said "a recent version" which implies that it previously worked?)

Riduidel commented 2 years ago

I'll collect some occurences of that weirdness.

We have

Riduidel commented 2 years ago

Seems like I have an other thing to check:

when opening the asciidoctor-kroki file (obtained from the rubygems maven mriror at torquebox), I have the following content (which is neither zip nor tar*)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <style type="text/css">
            html, body, #partner, iframe {
                height:100%;
                width:100%;
                margin:0;
                padding:0;
                border:0;
                outline:0;
                font-size:100%;
                vertical-align:baseline;
                background:transparent;
            }
            body {
                overflow:hidden;
            }
        </style>
        <meta content="NOW" name="expires">
        <meta content="index, follow, all" name="GOOGLEBOT">
        <meta content="index, follow, all" name="robots">
        <!-- Following Meta-Tag fixes scaling-issues on mobile devices -->
        <meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport">
    </head>
    <body>
        <div id="partner"></div>
        <script type="text/javascript">
            document.write(
                    '<script type="text/javascript" language="JavaScript"'
                            + 'src="//sedoparking.com/frmpark/'
                            + window.location.host + '/'
                            + 'tierraexpired'
                            + '/park.js">'
                    + '<\/script>'
            );
        </script>
    </body>
</html>

I may be wrong, but it seems like http://rubygems-proxy.torquebox.org/releases is no more a good url to fetch gems for maven projects ... And indeed, the link in the script fragment directs to sedoparking.com/frmpark/rubygems-proxy.torquebox.org/tierraexpired/park.js

Suddelny, all clarifies : there is an issue on rubygems project: torquebox.org domain is expired

Riduidel commented 2 years ago

Thanks to Twitter I've found an alternative proxy!

https://twitter.com/jruby/status/1216832621000282112

Riduidel commented 2 years ago

Well, that's weird, when trying to get asciidoctor-kroki through the http://mavengems.jruby.org/releases repository, I get the same file, which means that "new" url directs to the same content.

Riduidel commented 2 years ago

Let's try to give more visibility to that question ... I've asked it on StackOverflow.

Riduidel commented 2 years ago

Fixed by switching to another rubygem download maven plugin : the mavengem download plugin dynamically converts rubygem repository structure to maven one, allowing download of rubygems in amven without relying upon a translating proxy.

ggrossetie commented 2 years ago

without relying upon a translating proxy.

I think that's the right approach. We should probably recommend it on the Asciidoctor documentation. I don't mind adding instruction on how to install the Asciidoctor Kroki extension using Maven (and potentially Gradle) in the README. Could you please share a minimal pom.xml that converts an AsciiDoc file to HTML with the Asciidoctor Kroki extension enabled?