trulia / hologram

A markdown based documentation system for style guides.
http://trulia.github.io/hologram
Other
2.16k stars 199 forks source link

`get_binding` error #244

Open andyra opened 9 years ago

andyra commented 9 years ago

I ran hologram init and followed the quick start guide and ran Hologram, but I'm getting the following error: (erb):3:in ‘get_binding’: uninitialized constant Hologram::TemplateVariables::Rails (NameError). Any idea what could be causing this?

Using Ruby 2.1.5 and Rails 4.1.5

andyra commented 9 years ago

Here's the full error:

$ hologram
/usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rouge-1.9.1/lib/rouge/lexers/shell.rb:20: warning: already initialized constant Rouge::Lexers::Shell::KEYWORDS
/usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rouge-1.9.1/lib/rouge/lexers/shell.rb:20: warning: previous definition of KEYWORDS was here
/usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rouge-1.9.1/lib/rouge/lexers/shell.rb:25: warning: already initialized constant Rouge::Lexers::Shell::BUILTINS
/usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rouge-1.9.1/lib/rouge/lexers/shell.rb:25: warning: previous definition of BUILTINS was here
Adding renderer for haml examples
Adding renderer for html examples
Adding renderer for js examples
Adding renderer for jsx examples
Adding renderer for react examples
Adding renderer for slim examples
(erb):3:in `get_binding': uninitialized constant Hologram::TemplateVariables::Rails (NameError)
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/2.1.0/erb.rb:850:in `eval'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/2.1.0/erb.rb:850:in `result'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:236:in `write_erb'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:197:in `block in write_docs'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:185:in `each'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:185:in `write_docs'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:147:in `build_docs'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:87:in `build'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/cli.rb:38:in `build'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/lib/hologram/cli.rb:30:in `run'
    from /usr/local/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/hologram-1.4.0/bin/hologram:6:in `<top (required)>'
    from /usr/local/opt/rbenv/versions/2.1.5/bin/hologram:23:in `load'
    from /usr/local/opt/rbenv/versions/2.1.5/bin/hologram:23:in `<main>'
andyra commented 9 years ago

Note: hologram works OK in a different project I'm using with Ruby 2.2.2

jdcantrell commented 9 years ago

Hmm, I don't understand how Rails is affecting Hologram. I've installed ruby 2.1.5 and rails 4.1.5 but am still able to build without error. Have you made changes to the header or footer templates?

andyra commented 9 years ago

Nope, I didn't edit the header or footer templates—they're in their default states after hologram init.

lawwantsin commented 8 years ago

I'm having this issue. Any fix?

andyra commented 8 years ago

Sorry, @lawwantsin, I was never able to find a solution.

kpingel commented 8 years ago

I'm also having this issue... disheartening to see no solution so long after the original post. :confused:

KaraAJC commented 6 years ago

Having a similar issue, recently updated to Rails 5.2 and using webpacker:

Adding renderer for slim examples
Adding renderer for react examples
Adding renderer for html examples
Adding renderer for haml examples
Adding renderer for js examples
Adding renderer for jsx examples
W, [2018-05-21T17:57:31.865534 #18147]  WARN -- Skylight: [SKYLIGHT] [2.0.1] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message for all local apps, run `skylight disable_dev_warning`.)
Adding renderer for haml examples
bundler: failed to load command: hologram (/Users/kajc/.rbenv/versions/2.5.1/bin/hologram)
ArgumentError: wrong number of arguments (given 0, expected 1)
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionpack-5.2.0/lib/action_dispatch/http/request.rb:59:in `initialize'
  /Users/kajc/projects/CIW/chicago_ideas/styleguide_assets/templates/code_example_renderers/haml.rb:27:in `new'
  /Users/kajc/projects/CIW/chicago_ideas/styleguide_assets/templates/code_example_renderers/haml.rb:27:in `create'
  /Users/kajc/projects/CIW/chicago_ideas/styleguide_assets/templates/code_example_renderers/haml.rb:42:in `instance'
  (erb):13:in `get_binding'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/2.5.0/erb.rb:876:in `eval'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/2.5.0/erb.rb:876:in `result'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:243:in `write_page'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:199:in `block in write_docs'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:185:in `each'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:185:in `write_docs'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:147:in `build_docs'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/doc_builder.rb:87:in `build'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/cli.rb:38:in `build'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/lib/hologram/cli.rb:30:in `run'
  /Users/kajc/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/hologram-1.4.0/bin/hologram:6:in `<top (required)>'
  /Users/kajc/.rbenv/versions/2.5.1/bin/hologram:23:in `load'
  /Users/kajc/.rbenv/versions/2.5.1/bin/hologram:23:in `<top (required)>'

We use haml for our views, I'm looking at how ActionDispatch::TestRequest may have changed to see why it would need an argument.