lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

Yard server crashing when serving docs for one of my modules #429

Closed myronmarston closed 12 years ago

myronmarston commented 12 years ago

You can see the problem when you go here.

Locally, when I run yard server --reload, it crashes as well, and I get this backtrace:

[2011-12-17 11:38:23] ERROR NoMethodError: undefined method `parameters' for #<yardoc module VCR>
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/code_objects/base.rb:331:in `method_missing'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/templates/default/tags/html/tag.erb:13:in `block in _erb_cache_32'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/templates/default/tags/html/tag.erb:5:in `each'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/templates/default/tags/html/tag.erb:5:in `_erb_cache_32'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:238:in `erb'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/templates/default/tags/setup.rb:24:in `tag'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/templates/default/tags/setup.rb:33:in `param'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:314:in `render_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `each'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `block in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:345:in `add_options'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:206:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:228:in `block in yieldall'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:359:in `with_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:228:in `yieldall'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/templates/default/tags/html/index.erb:4:in `_erb_cache_15'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:238:in `erb'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:316:in `render_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `each'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `block in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:345:in `add_options'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:206:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:91:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:319:in `render_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `each'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `block in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:345:in `add_options'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:206:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:91:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:319:in `render_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `each'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `block in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:345:in `add_options'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:206:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:91:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:319:in `render_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `each'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `block in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:345:in `add_options'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:206:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:228:in `block in yieldall'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:359:in `with_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:228:in `yieldall'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/templates/default/layout/html/layout.erb:22:in `_erb_cache_0'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:238:in `erb'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:316:in `render_section'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `each'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:207:in `block in run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:345:in `add_options'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:206:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/template.rb:91:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/templates/engine.rb:88:in `render'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/code_objects/base.rb:442:in `format'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/commands/base.rb:141:in `render'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/commands/display_object_command.rb:11:in `run'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/commands/base.rb:95:in `call'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/commands/library_command.rb:49:in `call'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/router.rb:133:in `route_docs'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/router.rb:108:in `route'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/router.rb:54:in `call'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/yard-0.7.4/lib/yard/server/rack_adapter.rb:51:in `call'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call'
    /Users/myron/.rvm/gems/ruby-1.9.2-p290@vcr/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in `service'
    /Users/myron/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
    /Users/myron/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
    /Users/myron/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

It works fine for the other classes/modules in my project, and it used to work fine for this module. I'm not sure which doc comments broke it, but you can see what the current comments are here.

Any ideas how to fix or work around this?

lsegal commented 12 years ago

Does this always happen? I can't reproduce it with your repo. Note that the yard server --reload command does not delete elements that you remove from code between reloads, so sometimes you will see methods in the docs that you had previously removed or renamed. This is a design flaw in the server, but the server reload feature is just meant for quickly adding docs, not changing code, so it works well for that use case. If you do end up deleting/moving things, you can quickly delete the .yardoc db and restart the server when you make these kinds of changes. If you delete the .yardoc and restart, does it happen again?

myronmarston commented 12 years ago

I deleted the .yardoc folder and that fixed it. Sorry about the noise :(.

lsegal commented 12 years ago

No problem. This is also something we should doc better!

myronmarston commented 12 years ago

I've got repro steps for this now:

cd vcr
git checkout 7e790d655a4eaf673d742eed10208702f4ee7109
rm -rf .yardoc
rm -rf doc
yard server --reload

Browse to the doc page for the VCR module and you'll get the error. The very next commit fixes the issue. Apparently the extra comments (that I didn't mean to add and commit) cause the issue; I removed them when I noticed them, not realizing it was related to the error I was getting, so when you tried to repro the error it didn't occur anymore.

This isn't really a problem for me anymore (since the problematic comments have been removed) but it seems like a bug in YARD, so I reopened the issue.

lsegal commented 12 years ago

Thanks for managing to reproduce this. Just a minor issue with rendering, it seems. Fixed!

myronmarston commented 12 years ago

Cool, thanks for the quick fix!