paulsamuels / SBConstants

MIT License
311 stars 28 forks source link

Verbose option crash #17

Closed Ashton-W closed 9 years ago

Ashton-W commented 9 years ago

The Objective-C templates will crash when -v or --verbose option is used:

(erb):9:in `block (2 levels) in method_missing': undefined local variable or method `constant' for #<SBConstants::ObjcConstantWriter:0x007fbdb3a6c200> (NameError)
    from (erb):6:in `each'
    from (erb):6:in `block in method_missing'
    from (erb):4:in `each'
    from (erb):4:in `method_missing'
    from /usr/local/var/rbenv/versions/2.1.3/lib/ruby/2.1.0/erb.rb:850:in `eval'
    from /usr/local/var/rbenv/versions/2.1.3/lib/ruby/2.1.0/erb.rb:850:in `result'
    from /Users/X/.gem/gems/sbconstants-1.1.0/lib/sbconstants/objc_constant_writer.rb:37:in `template_with_file'
    from /Users/X/.gem/gems/sbconstants-1.1.0/lib/sbconstants/objc_constant_writer.rb:25:in `header'
    from /Users/X/.gem/gems/sbconstants-1.1.0/lib/sbconstants/objc_constant_writer.rb:16:in `write'
    from /Users/X/.gem/gems/sbconstants-1.1.0/lib/sbconstants/cli.rb:94:in `write'
    from /Users/X/.gem/gems/sbconstants-1.1.0/lib/sbconstants/cli.rb:19:in `run'
    from /Users/X/.gem/gems/sbconstants-1.1.0/lib/sbconstants/cli.rb:8:in `run'
    from /Users/X/.gem/gems/sbconstants-1.1.0/bin/sbconstants:5:in `<top (required)>'
    from /Users/X/.gem/bin/sbconstants:23:in `load'
    from /Users/X/.gem/bin/sbconstants:23:in `<main>'
paulsamuels commented 9 years ago

@Ashton-W nice spot - does the attached pull request fix your issue?

Ashton-W commented 9 years ago

It has stopped the crash, but I seem to be getting no output at all?

edit: Oh! I misunderstood the expected output, yes it is showing extra information in the generated header.