oreillymedia / asciidoctor-htmlbook

Templates for the htmlbook backend for Asciidoctor
45 stars 15 forks source link

uninitialized constant Tilt (NameError) when running convert_book.rb #88

Open rdhyee opened 9 years ago

rdhyee commented 9 years ago

When I try to run to convert an AsciiDoc file in my folder (dubliners, in case):

ruby scripts/convert_book.rb dubliners

I run into the following error:

Failed to parse source, uninitialized constant Tilt (NameError)

in the context of the full error message:

/usr/local/lib/ruby/gems/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1362:in `rescue in load': asciidoctor: FAILED: <stdin>: Failed to parse source, uninitialized constant Tilt (NameError)
    from /usr/local/lib/ruby/gems/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1281:in `load'
    from /usr/local/lib/ruby/gems/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458:in `convert'
    from scripts/convert_book.rb:12:in `block in <main>'
    from scripts/convert_book.rb:9:in `glob'
    from scripts/convert_book.rb:9:in `<main>'

I'm running

ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13]

on OS X 10.9.5

with the following gems:

asciidoctor (1.5.2)
bigdecimal (1.2.7, 1.2.6)
bundler (1.9.3)
diff-lcs (1.2.4)
faraday (0.9.1)
highline (1.7.1, 1.6.21)
io-console (0.4.3)
json (1.8.2, 1.8.1)
librarian (0.1.2)
librarian-ansible (1.0.6)
mini_portile (0.6.2)
minitest (5.5.1, 5.4.3)
multipart-post (2.0.0)
nokogiri (1.5.10)
power_assert (0.2.3, 0.2.2)
psych (2.0.13, 2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rspec (2.14.1)
rspec-core (2.14.6)
rspec-expectations (2.14.3)
rspec-mocks (2.14.3)
test-unit (3.0.9, 3.0.8)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1, 1.4.1)

I get the same problem regardless what AsciiDoc file I have in dubliners.

I'm a newbie rubyist, so I might be simply making a rookie error. Please advise. Thanks in advance.

rdhyee commented 9 years ago

I think @sethwoodworth provided me with the solution: add

require 'tilt'

to convert_books.rb. Let me try the solution more thoroughly and issue a PR if I think that is the solution.

rdhyee commented 9 years ago

Changes I've been making so far in getting asciidoctor-htmlbook to work for me: https://github.com/oreillymedia/asciidoctor-htmlbook/compare/master...rdhyee:master

akaziuna commented 9 years ago

Thanks for sharing this! Much appreciated! I was getting the exact same errors.

As of commit 9404c4fdd13925874d2a863a6ceecae4d6acc444 on 8/11/2015 (or sooner) all my build issues were resolved simply adding: require 'tilt' to convert_books.rb. I didn't have to do anything else and HTMBook now builds perfectly.

Running: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]

I installed these gems for asciidoctor: https://rubygems.org/gems/asciidoctor/versions/1.5.2

Here's the full list of my installed gems, incase there's a dependency that could help someone else: * LOCAL GEMS * asciidoctor (1.5.2) bigdecimal (1.2.7, 1.2.6) builder (3.2.2) coderay (1.1.0) cucumber (2.0.2) cucumber-core (1.2.0) diff-lcs (1.2.5) erubis (2.7.0) gherkin (2.12.2) haml (4.0.7) io-console (0.4.3) json (1.8.3, 1.8.1) mini_portile (0.6.2) minitest (5.8.0, 5.4.3) multi_json (1.11.2) multi_test (0.1.2) nokogiri (1.6.6.2) power_assert (0.2.4, 0.2.2) psych (2.0.13, 2.0.8) rake (10.4.2) rdoc (4.2.0) rspec-expectations (3.3.1) rspec-support (3.3.0) sass (3.4.16) slim (3.0.6) temple (0.7.6) test-unit (3.1.3, 3.0.8) thread_safe (0.3.5) tilt (2.0.1) tomparse (0.4.2) yard (0.8.7.6) yard-tomdoc (0.7.1)