lib/travis/cli/command.rb in travis-1.6.15.travis.561.6 vs lib/travis/cli/command.rb in travis-1.6.15.travis.562.6

- old
+ new

@@ -336,12 +336,19 @@ path = config_path(name) debug "Storing %p" % path File.write(path, content.to_s) end + YAML_ERROR = defined?(Psych::SyntaxError) ? Psych::SyntaxError : ArgumentError def load_config - @config = YAML.load load_file('config.yml', '{}') + @config = YAML.load load_file('config.yml', '{}') + @config ||= {} @original_config = @config.dup + rescue YAML_ERROR => error + raise error if explode? + warn "Broken config file: #{color config_path('config.yml'), :bold}" + exit 1 unless interactive? and agree("Remove config file? ") { |q| q.default = "no" } + @original_config, @config = {}, {} end def store_config save_file('config.yml', @config.to_yaml) end