lib/cc/cli/upgrade_config_generator.rb in codeclimate-0.11.0 vs lib/cc/cli/upgrade_config_generator.rb in codeclimate-0.13.0

- old
+ new

@@ -1,12 +1,20 @@ require "cc/cli/config_generator" module CC module CLI class UpgradeConfigGenerator < ConfigGenerator + def can_generate? + errors.blank? + end + + def errors + existing_yaml.errors + end + def exclude_paths - existing_yaml["exclude_paths"] || [] + (existing_yaml.exclude_paths || []).map(&:to_s) end def post_generation_verb "upgraded" end @@ -21,14 +29,14 @@ base_eligble end end def classic_languages - @classic_languages ||= existing_yaml["languages"].reject { |_, v| !v }.map(&:first) + @classic_languages ||= existing_yaml.languages.reject { |_, v| !v }.map(&:first) end def existing_yaml - @existing_yml ||= YAML.safe_load(File.read(CODECLIMATE_YAML)) + @existing_yaml ||= CC::Yaml.parse(File.read(CODECLIMATE_YAML)) end end end end