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

Parse error for any file / content with Ruby 1.9.3-p392 & toml v0.0.2 #9

Closed
stevenhaddox opened this issue Mar 7, 2013 · 13 comments
Closed

Comments

@stevenhaddox
Copy link
Contributor

$ bundle show toml
Resolving dependencies...
/Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.2
$ cat config/support.toml
pub_key_path = "$HOME/id_dsa.pub"
$ b ruby -e "require 'toml';TOML.load('config/support.toml');"
/Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/parslet-1.5.0/lib/parslet/cause.rb:63:in `raise': Extra input after last repetition at line 1 char 1. (Parslet::ParseFailed)
    from /Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/parslet-1.5.0/lib/parslet/atoms/base.rb:46:in `parse'
    from /Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.2/lib/toml/parser.rb:9:in `initialize'
    from /Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.2/lib/toml.rb:16:in `new'
    from /Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.2/lib/toml.rb:16:in `load'
    from -e:1:in `<main>'
@jm
Copy link
Owner

jm commented Mar 7, 2013

Try adding a newline to the end of the file. I think that's fixed on master?

@dirk
Copy link
Collaborator

dirk commented Mar 7, 2013

If it wouldn't be too much trouble, could you show me what your (sanitized for anything sensitive) config/support.toml file looks like? Thanks!

It may be the trailing-newline bug like @jm said.

@stevenhaddox
Copy link
Contributor Author

@jm @dirk: Literally the line that it output from cat:

$ cat config/support.toml
pub_key_path = "$HOME/id_dsa.pub"

I added in the newline to try it out and still got the same error. Thanks for working on this and for such fast responses ;)

@stevenhaddox
Copy link
Contributor Author

@jm is there a way to point to a gem's git repo from within a gemspec? I don't know that one off-hand...

@jm
Copy link
Owner

jm commented Mar 7, 2013

I don't think so but you can add extra deps to the Gemfile for testing maybe?

@dirk
Copy link
Collaborator

dirk commented Mar 7, 2013

Okay. I'm unable to replicate this on master with ruby 1.9.3p374. May have been fixed since v0.0.2.

@stevenhaddox: Unfortunately no. (Cite: StackOverflow)

@jm Want to bump it to v0.0.3 and push to Rubygems? There aren't any problems on master HEAD to my knowledge.

@jm
Copy link
Owner

jm commented Mar 7, 2013

Just pushed a new version; pull it down and give it a shot!

@stevenhaddox
Copy link
Contributor Author

@jm @dirk: thanks. I'll follow-up momentarily.

@stevenhaddox
Copy link
Contributor Author

Apparently I'm really good at breaking things...

SUPPORT (centos_chef_solo) $ bundle show toml
Resolving dependencies...
/Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.3
SUPPORT (centos_chef_solo) $ cat config/support.toml
pub_key_path = "$HOME/id_dsa.pub"

SUPPORT (centos_chef_solo) $ b ruby -e "require 'toml';TOML.load('config/support.toml');"
Failed to match sequence (ALL_SPACE (KEY_GROUP / KEY_VALUE / COMMENT_LINE){0, } ALL_SPACE) at line 1 char 1.
`- Don't know what to do with "config/sup" at line 1 char 1.
/Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.3/lib/toml/parser.rb:21:in `initialize': undefined method `each' for nil:NilClass (NoMethodError)
    from /Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.3/lib/toml.rb:20:in `new'
    from /Users/steven/.rvm/gems/ruby-1.9.3-p392/gems/toml-0.0.3/lib/toml.rb:20:in `load'
    from -e:1:in `<main>'
SUPPORT (centos_chef_solo) $ b ruby -e "require 'toml';TOML::Parser(\"key='value'\").parsed;"
-e:1:in `<main>': undefined method `Parser' for TOML:Module (NoMethodError)

@stevenhaddox
Copy link
Contributor Author

Also, there's quite a few gems in this project. I'm going to try it in a blank gemset and see if it makes a difference there...

@dirk
Copy link
Collaborator

dirk commented Mar 7, 2013

Ah. You're going to want to do TOML.load_file instead of TOML.load (load expects a string to be parsed). Also, do TOML::Parser.new(...).parsed (just need that pesky little .new in there). Hope that works!

@stevenhaddox
Copy link
Contributor Author

@dirk: do'h. I could've sworn I had that right. #fail

Thanks. Seems to work awesome now (even without the extra newline). Sorry if I cause a release over a mental parsing error 😖

@dirk
Copy link
Collaborator

dirk commented Mar 7, 2013

No worries! Glad to help. 😄

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

No branches or pull requests

3 participants