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

YAML.load_file causes error #56

Closed
kenaniah opened this issue Dec 8, 2015 · 4 comments
Closed

YAML.load_file causes error #56

kenaniah opened this issue Dec 8, 2015 · 4 comments

Comments

@kenaniah
Copy link

kenaniah commented Dec 8, 2015

https://github.com/skylightio/skylight-ruby/blob/master/lib/skylight/user_config.rb#L25 throws an error when it encounters an empty yaml file at ~/.skylight

/usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:26:in `reload': undefined method `[]' for false:FalseClass (NoMethodError)
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:13:in `initialize'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:9:in `new'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:9:in `instance'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/railtie.rb:36:in `block in <class:Railtie>'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `instance_exec'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `run'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'

This sometimes happens if a user uninstalls the skylight gem and reinstalls it.

@wagenet
Copy link
Contributor

wagenet commented Dec 8, 2015

Thanks for the report. I'll look into this.

@kenaniah
Copy link
Author

kenaniah commented Dec 8, 2015

FYI, the error can be easily reproduced by truncating the ~/.skylight file. With zero content, it is not a valid YAML file and the YAML parser returns false, which causes this error to propagate.

@wagenet
Copy link
Contributor

wagenet commented Dec 8, 2015

Yup, it's a simple fix, just forgot that it returned false if it couldn't parse. Thanks again!

@wagenet
Copy link
Contributor

wagenet commented Sep 28, 2017

Was fixed a while ago.

@wagenet wagenet closed this as completed Sep 28, 2017
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

2 participants