Asciidoctor-pdf: fresh install of ruby and asciidoctor-pdf does not work

Created on 14 Mar 2017  路  20Comments  路  Source: asciidoctor/asciidoctor-pdf

Have installed everything on a virgin windows PC using gem. Something seems to be missing...

>ruby --version
ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]

>asciidoctor-pdf -v
C:/Ruby22/lib/ruby/gems/2.2.0/gems/prawn-templates-0.0.3/lib/prawn/templates.rb:246:in `<top (required)>': can't modify frozen Array (RuntimeError)
    from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/converter.rb:10:in `<top (required)>'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `require_relative'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `<top (required)>'
    from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/bin/asciidoctor-pdf:4:in `<top (required)>'
    from C:/Ruby22/bin/asciidoctor-pdf:23:in `load'
    from C:/Ruby22/bin/asciidoctor-pdf:23:in `<main>'
bug duplicate

All 20 comments

Similar problem also on Ubuntu...

The same problem on OSX

[~]$ ruby --version
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

[~]$ asciidoctor-pdf -v
/usr/local/lib/ruby/gems/2.4.0/gems/prawn-templates-0.0.3/lib/prawn/templates.rb:246:in `<top (required)>': can't modify frozen Array (RuntimeError)
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/converter.rb:10:in `<top (required)>'
    from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `require_relative'
    from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
    from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.14/bin/asciidoctor-pdf:4:in `<top (required)>'
    from /usr/local/bin/asciidoctor-pdf:22:in `load'
    from /usr/local/bin/asciidoctor-pdf:22:in `<main>'

It seems that updating prawn to 2.1.0 can solve the problem

Made
gem update
that did not help.

Updating to prawn 2.1.0: Does not help for me:

    >gem install prawn -v 2.1.0 
    Fetching: pdf-core-0.6.1.gem (100%)
    Successfully installed pdf-core-0.6.1
    Fetching: ttfunk-1.4.0.gem (100%)
    Successfully installed ttfunk-1.4.0
    Fetching: prawn-2.1.0.gem (100%)
    Successfully installed prawn-2.1.0
    Parsing documentation for pdf-core-0.6.1
    Installing ri documentation for pdf-core-0.6.1
    Parsing documentation for ttfunk-1.4.0
    Installing ri documentation for ttfunk-1.4.0
    Parsing documentation for prawn-2.1.0
    Installing ri documentation for prawn-2.1.0
    Done installing documentation for pdf-core, ttfunk, prawn after 7 seconds
    3 gems installed

    >asciidoctor-pdf -v
    C:/Ruby22/lib/ruby/gems/2.2.0/gems/prawn-templates-0.0.4/lib/prawn/templates.rb:254:in `<top (required)>': can't modify frozen Array (RuntimeError)
            from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
            from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
            from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
            from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/converter.rb:10:in `<top (required)>'
            from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `require_relative'
            from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `<top (required)>'
            from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
            from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
            from C:/Ruby22/lib/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/bin/asciidoctor-pdf:4:in `<top (required)>'
            from C:/Ruby22/bin/asciidoctor-pdf:23:in `load'
            from C:/Ruby22/bin/asciidoctor-pdf:23:in `<main>'

Needed to do

    >gem uninstall prawn -v 2.2.0

then it worked.

This is covered in the README. Please see prerequisites section. The new
release of Prawn broke many things. You'll need to force install Prawn
2.1.0 until a new release of Asciidoctor PDF.

In the future, we are locking the version of Prawn.

I'm going to keep this issue open so that people can find it until the new release is out.

The relevant issue in prawn-templates is https://github.com/prawnpdf/prawn-templates/issues/14 which is apparently resolved on master.

I'm reverting to Prawn 2.1.0 for now.

That's one problem. There were others. I'll do an alpha.15 release this weekend so we can get past this workaround.

Can anyone postback if the current master of prawn-templates with prawn 2.2.1 fixes the issue? Once confirmed, I'd go ahead and push the release then.

# gem update prawn
Updating installed gems
Updating prawn
Fetching: prawn-2.2.1.gem (100%)
Successfully installed prawn-2.2.1
Parsing documentation for prawn-2.2.1
Installing ri documentation for prawn-2.2.1
Installing darkfish documentation for prawn-2.2.1
Done installing documentation for prawn after 3 seconds
Parsing documentation for prawn-2.2.1
Done installing documentation for prawn after 1 seconds
Gems updated: prawn
^D
> asciidoctor-pdf.ruby2.2 -v
/usr/lib64/ruby/gems/2.2.0/gems/prawn-templates-0.0.3/lib/prawn/templates.rb:246:in `<top (required)>': can't modify frozen Array (RuntimeError)
        from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
        from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
        from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
        from /usr/lib64/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/converter.rb:10:in `<top (required)>'
        from /usr/lib64/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `require_relative'
        from /usr/lib64/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf.rb:3:in `<top (required)>'
        from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/lib64/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/lib64/ruby/gems/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.14/bin/asciidoctor-pdf:4:in `<top (required)>'
        from /usr/bin/asciidoctor-pdf.ruby2.2:23:in `load'
        from /usr/bin/asciidoctor-pdf.ruby2.2:23:in `<main>'

Sorry, if I wasn't precise - I was referring to master of prawn-templates

@bvogel It will work because I added a workaround. The workaround would need to be removed in order to check. I'll do that now.

It works, but it generates a warning. I recommend using the workaround that I came up instead.

See https://github.com/asciidoctor/asciidoctor-pdf/blob/master/lib/asciidoctor-pdf/prawn-templates_ext.rb#L2

(I didn't bother refreezing since I really see no point in freezing this array in the first place).

I didn't bother about the warning, you about re-freezing... I'll change my code an push the gem... Thanks for testing!

issue has been fixed in prawn-templates 0.0.5

@bvogel Thanks for letting me know. I'll update Asciidoctor PDF and put out a new release.

While we're chatting, I want to emphasize how important prawn-templates is for Asciidoctor PDF. Many users need to be able to import PDF pages from other sources and prawn-templates allows us to provide that feature. We're happy to see it being maintained. Thanks!

I'm starting to work on the alpha.15 release.

This is resolved in the upcoming alpha.15 release.

Was this page helpful?
0 / 5 - 0 ratings