Sha256: 36436ff77c3a7ed294d424e58a75019009acbed9628417c05d9dea030d87bcbd

Contents?: true

Size: 1019 Bytes

Versions: 37

Compression:

Stored size: 1019 Bytes

Contents

require "cc/analyzer"

module CC
  module CLI
    module Engines
      class Enable < EngineCommand
        ARGUMENT_LIST = "<engine_name>".freeze
        SHORT_HELP = "Enable an engine in your codeclimate.yml.".freeze
        HELP = "#{SHORT_HELP}\n" \
          "\n"\
          "    <engine_name>    Engine to enable in your codeclimate.yml".freeze

        def run
          require_codeclimate_yml

          if !engine_exists?
            say "Engine not found. Run 'codeclimate engines:list' for a list of valid engines."
          elsif engine_enabled?
            say "Engine already enabled."
            pull_docker_images
          else
            enable_engine
            update_yaml
            say "Engine added to .codeclimate.yml."
            pull_docker_images
          end
        end

        private

        def pull_docker_images
          Engines::Install.new.run
        end

        def enable_engine
          parsed_yaml.enable_engine(engine_name)
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
codeclimate-0.59.0 lib/cc/cli/engines/enable.rb
codeclimate-0.58.0 lib/cc/cli/engines/enable.rb
codeclimate-0.57.0 lib/cc/cli/engines/enable.rb
codeclimate-0.56.0 lib/cc/cli/engines/enable.rb
codeclimate-0.55.0 lib/cc/cli/engines/enable.rb
codeclimate-0.54.0 lib/cc/cli/engines/enable.rb
codeclimate-0.53.0 lib/cc/cli/engines/enable.rb
codeclimate-0.52.0 lib/cc/cli/engines/enable.rb
codeclimate-0.51.3 lib/cc/cli/engines/enable.rb
codeclimate-0.51.2 lib/cc/cli/engines/enable.rb
codeclimate-0.51.1 lib/cc/cli/engines/enable.rb
codeclimate-0.51.0 lib/cc/cli/engines/enable.rb
codeclimate-0.50.0 lib/cc/cli/engines/enable.rb
codeclimate-0.49.0 lib/cc/cli/engines/enable.rb
codeclimate-0.48.0 lib/cc/cli/engines/enable.rb
codeclimate-0.47.0 lib/cc/cli/engines/enable.rb
codeclimate-0.46.0 lib/cc/cli/engines/enable.rb