razum2um / lurker

📖 The ultimate tool for documenting and testing APIs in Rails
https://lurker.razum2um.me/lurker
MIT License
116 stars 22 forks source link

Endpoint presenter error #110

Closed yorikim closed 9 years ago

yorikim commented 9 years ago

Добрый день. При попытке сгенерировать любую документацию возникает исключение. Воспроизвести ошибку можно следующим образом:

sw_vers 
#ProductName:   Mac OS X
#ProductVersion:    10.10.5
#BuildVersion:  14F1021

git clone https://github.com/sanyco86/qna.git
git checkout lesson_15

rvm gemset create qna
rvm use 2.2.3@qna
echo ruby-2.2.3 > .ruby-version
echo qna > .ruby-gemset

gem install bundler --no-rdoc --no-ri
bundle install

rm -rf lurker
rm -rf public/lurker
rspec spec/api/v1/

lurker init_docs # создаются доки
lurker convert #возникает та же ошибка, что и у меня.

/.rvm/gems/ruby-2.2.3@qna/gems/lurker-0.6.10/lib/lurker/presenters/endpoint_presenter.rb:140:in `named_path': undefined method `sub' for nil:NilClass (ActionView::Template::Error)

Текст исключения:

/usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/presenters/endpoint_presenter.rb:140:in `named_path': undefined method `sub' for nil:NilClass (ActionView::Template::Error)
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/templates/layouts/_sidemenu.html.erb:10:in `block (2 levels) in __usr_local_rvm_gems_ruby_______so_gems_lurker________lib_lurker_templates_layouts__sidemenu_html_erb___700750596495858882_20275880'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/templates/layouts/_sidemenu.html.erb:5:in `each'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/templates/layouts/_sidemenu.html.erb:5:in `block in __usr_local_rvm_gems_ruby_______so_gems_lurker________lib_lurker_templates_layouts__sidemenu_html_erb___700750596495858882_20275880'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/templates/layouts/_sidemenu.html.erb:1:in `each'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/templates/layouts/_sidemenu.html.erb:1:in `__usr_local_rvm_gems_ruby_______so_gems_lurker________lib_lurker_templates_layouts__sidemenu_html_erb___700750596495858882_20275880'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/template.rb:145:in `block in render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/template.rb:333:in `instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/template.rb:143:in `render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `block in instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/partial_renderer.rb:309:in `render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/renderer.rb:47:in `render_partial'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/helpers/rendering_helper.rb:35:in `render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/templates/layouts/application.html.erb:41:in `__usr_local_rvm_gems_ruby_______so_gems_lurker________lib_lurker_templates_layouts_application_html_erb___3849730247063454525_29027580'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/template.rb:145:in `block in render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/template.rb:333:in `instrument'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/template.rb:143:in `render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/template_renderer.rb:14:in `render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/renderer.rb:42:in `render_template'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/renderer/renderer.rb:23:in `render'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/rendering.rb:100:in `_render_template'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionview-4.2.3/lib/action_view/rendering.rb:83:in `render_to_body'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/actionpack-4.2.3/lib/abstract_controller/rendering.rb:43:in `render_to_string'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/presenters/service_presenter.rb:19:in `to_html'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/cli.rb:89:in `convert_to_html'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/cli.rb:74:in `block in convert'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/thor-0.19.1/lib/thor/actions.rb:184:in `block in inside'
    from /usr/local/rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:127:in `chdir'
    from /usr/local/rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/fileutils.rb:127:in `cd'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/thor-0.19.1/lib/thor/actions.rb:184:in `inside'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/lib/lurker/cli.rb:68:in `convert'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /usr/local/rvm/gems/ruby-2.2.3@so/gems/lurker-0.6.10/bin/lurker:14:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.2.3@so/bin/lurker:23:in `load'
    from /usr/local/rvm/gems/ruby-2.2.3@so/bin/lurker:23:in `<main>'
    from /usr/local/rvm/gems/ruby-2.2.3@so/bin/ruby_executable_hooks:15:in `eval'
    from /usr/local/rvm/gems/ruby-2.2.3@so/bin/ruby_executable_hooks:15:in `<main>'
razum2um commented 9 years ago

@yorikim thanks for nice bug report :+1: fixed in 0.6.11

I also advise to change in your application's config/routes.rb:

-  namespace :api do
+  namespace :api, defaults: { format: 'json' } do