Sha256: 2fb881ef4ada88c39c7498f401f9612739311d68a326f5e94ff39d2dd1fab70f

Contents?: true

Size: 969 Bytes

Versions: 23

Compression:

Stored size: 969 Bytes

Contents

require "cc/analyzer"

module CC
  module CLI
    module Engines
      class EngineCommand < Command
        include CC::Analyzer

        private

        def engine_name
          @engine_name ||= @args.first
        end

        def parsed_yaml
          @parsed_yaml ||= CC::Analyzer::Config.new(yaml_content)
        end

        def yaml_content
          filesystem.read_path(CODECLIMATE_YAML).freeze
        end

        def update_yaml
          filesystem.write_path(CODECLIMATE_YAML, parsed_yaml.to_yaml)
        end

        def engine_present_in_yaml?
          parsed_yaml.engine_present?(engine_name)
        end

        def engine_enabled?
          parsed_yaml.engine_enabled?(engine_name)
        end

        def engine_exists?
          engines_registry_list.keys.include?(engine_name)
        end

        def engines_registry_list
          @engines_registry_list ||= CC::Analyzer::EngineRegistry.new.list
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
codeclimate-0.0.11 lib/cc/cli/engines/engine_command.rb
codeclimate-0.0.10 lib/cc/cli/engines/engine_command.rb
codeclimate-0.0.9 lib/cc/cli/engines/engine_command.rb