Sha256: 7d60880a89a943d5b46051ed3c033616fced60b5f77a0b63cfe54a555bdeece7

Contents?: true

Size: 770 Bytes

Versions: 15

Compression:

Stored size: 770 Bytes

Contents

require "cc/cli/config_generator"

module CC
  module CLI
    class UpgradeConfigGenerator < ConfigGenerator
      def exclude_paths
        existing_yaml["exclude_paths"] || []
      end

      def post_generation_verb
        "upgraded"
      end

      private

      def engine_eligible?(engine)
        base_eligble = super
        if engine["upgrade_languages"].present?
          base_eligble && (engine["upgrade_languages"] & classic_languages).any?
        else
          base_eligble
        end
      end

      def classic_languages
        @classic_languages ||= existing_yaml["languages"].reject { |_, v| !v }.map(&:first)
      end

      def existing_yaml
        @existing_yml ||= YAML.safe_load(File.read(CODECLIMATE_YAML))
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
codeclimate-0.11.0 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.10.1 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.10.0 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.7 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.6 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.5 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.4 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.3 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.2 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.1 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.9.0 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.8.1 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.8.0 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.7.2 lib/cc/cli/upgrade_config_generator.rb
codeclimate-0.7.0 lib/cc/cli/upgrade_config_generator.rb