sms-fu icon indicating copy to clipboard operation
sms-fu copied to clipboard

YAML parsing error

Open alexsoble opened this issue 10 years ago • 3 comments

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?

alexsoble avatar Mar 05 '14 12:03 alexsoble

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

m0dd3r avatar Mar 27 '14 20:03 m0dd3r

Seeing this as welll

spilliton avatar Oct 12 '14 01:10 spilliton

+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 avatar Oct 17 '14 14:10 brundage