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 parsing error #15

Open
alexsoble opened this issue Mar 5, 2014 · 3 comments
Open

YAML parsing error #15

alexsoble opened this issue Mar 5, 2014 · 3 comments

Comments

@alexsoble
Copy link
Contributor

Calling .deliver threw an error that originates in the sms_fu.yml file:

Psych::SyntaxError: (): found character that cannot start any token while scanning for the next token at line 89 column 13

Psych is the YAML parser and doesn't play well with values starting with "@". Trying to wrap carrier values in strings (i.e. @gin.nl => "@gin.nl") didn't help. Calling YAML::ENGINE.yamler = 'syck' fixed the issue for me:
http://stackoverflow.com/questions/4980877/rails-error-couldnt-parse-yaml

What's the best approach here? Could we set YAML::ENGINE.yamler = 'syck' in the context of this gem without affecting the YAML settings of every app that installs it?

@m0dd3r
Copy link

m0dd3r commented Mar 27, 2014

I'm running into this too, but only when running in my test environment. We provide our own config/sms_fu.yml file with all the carrier values wrapped in single quotes and it works fine. However, it looks like the code here is using the sms_fu.yml provided in the templates directory when Rails.env is 'test'

def template_directory
  directory = defined?(Rails) ? "#{Rails.root}/config" : "#{File.dirname(__FILE__)}/../../templates"
   if (defined?(Rails) && Rails.env == 'test') || (defined?(RAILS_ENV) && RAILS_ENV == 'test)')
     "#{File.dirname(__FILE__)}/../../templates"
    else
      directory
    end
end

So when I run my tests, this blows up. This has only become an issue since updating to ruby 2.1.0

@spilliton
Copy link

Seeing this as welll

@brundage
Copy link

+1 while processing templates/sms_fu.yml

irb(main):005:0> RUBY_VERSION
=> "2.0.0"

irb(main):006:0> YAML::load File.open('/home/brundage/.gem/ruby/2.0.0/gems/sms_fu-1.1.2/templates/sms_fu.yml')
Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 7 column 12
    from /usr/lib64/ruby/2.0.0/psych.rb:205:in `parse'
    from /usr/lib64/ruby/2.0.0/psych.rb:205:in `parse_stream'
    from /usr/lib64/ruby/2.0.0/psych.rb:153:in `parse'
    from /usr/lib64/ruby/2.0.0/psych.rb:129:in `load'
    from (irb):6
    from /usr/bin/irb:12:in `<main>'

brundage pushed a commit to brundage/sms-fu that referenced this issue Oct 17, 2014
matt297 added a commit to matt297/sms-fu that referenced this issue Nov 17, 2015
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

4 participants