Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rdoc formatter #201

Open
wants to merge 2 commits into
base: gli-2
Choose a base branch
from
Open

Fix rdoc formatter #201

wants to merge 2 commits into from

Conversation

luxflux
Copy link

@luxflux luxflux commented Nov 10, 2014

Running GLI_DEBUG=true bin/my-cli _doc fails with the following stack trace. This patch fixes it.

I didn't check why the tests aren't failing even though todo.feature has a test for this formatter.

error: undefined method `exe_name' for nil:NilClass
/opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/commands/rdoc_document_listener.rb:23:in `program_desc': undefined method `exe_name' for nil:NilClass (NoMethodError)
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/commands/doc.rb:37:in `document'
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/commands/doc.rb:26:in `block in initialize'
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/command_support.rb:126:in `call'
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/command_support.rb:126:in `execute'
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/app_support.rb:290:in `block in call_command'
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/app_support.rb:303:in `call'
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/app_support.rb:303:in `call_command'
        from /opt/boxen/rbenv/versions/1.9.3-p547/gemsets/my-cli/gems/gli-2.12.2/lib/gli/app_support.rb:81:in `run'

@davetron5000
Copy link
Owner

Weird. Any chance your app namespaces include GLI::App? I bet the todo test app just includes it into the global namespace, which has the side-effect of making exe_name from GLI::AppSupport available everywhere.

Thanks for finding this. Will merge soon, and I think I should probably change the test apps to namespace GLI, as this isn't the first issue that's come up related to that.

@luxflux
Copy link
Author

luxflux commented Nov 10, 2014

In the CLI class, there is an extend of GLI::App. As this is the only place where GLI is used, that's the only "include".

module InfrastructureClient
  class CLI
    extend GLI::App

    program_desc 'With this client, manage the infrastructure, you can.'

@davetron5000
Copy link
Owner

Cool, that's what I thought. You are doing it right, and GLI is busted (as you've discovered).

@davetron5000
Copy link
Owner

It's been a while, but just wanted to post that I'm still looking at this. This PR is good, but I'd like to find all other instances of this being a problem in the app. Have not forgotten…

@halostatue
Copy link

Until this is merged and released, this can be patched with:

# Work around a bug with the RdocDocumentListener
module RdocDocumentListenerAppFix
  def initialize(_global_options,_options,_arguments,app)
    super
    @app = app
  end
end
class GLI::Commands::RdocDocumentListener
  prepend RdocDocumentListenerAppFix
end

@rberger
Copy link

rberger commented Jan 4, 2018

This is still a problem in gli-2.17.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants