Sha256: f33c50e9e43e00ca0b6f21b6b7590215016015c5a5476330051e48fad4ecfff9

Contents?: true

Size: 1.03 KB

Versions: 37

Compression:

Stored size: 1.03 KB

Contents

module CC
  module CLI
    module Engines
      class Install < EngineCommand
        SHORT_HELP = "Pull the latest images for enabled engines in your codeclimate.yml.".freeze

        ImagePullFailure = Class.new(StandardError)

        def run
          require_codeclimate_yml

          say "Pulling docker images."
          pull_docker_images
        end

        private

        def pull_docker_images
          engine_names.each do |name|
            if engine_registry.exists?(name)
              images = engine_registry[name]["channels"].values
              images.each { |image| pull_engine_image(image) }
            else
              warn("unknown engine name: #{name}")
            end
          end
        end

        def engine_names
          @engine_names ||= parsed_yaml.engine_names
        end

        def pull_engine_image(engine_image)
          unless system("docker pull #{engine_image}")
            raise ImagePullFailure, "unable to pull image #{engine_image}"
          end
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
codeclimate-0.69.0 lib/cc/cli/engines/install.rb
codeclimate-0.68.0 lib/cc/cli/engines/install.rb
codeclimate-0.67.0 lib/cc/cli/engines/install.rb
codeclimate-0.66.0 lib/cc/cli/engines/install.rb
codeclimate-0.65.0 lib/cc/cli/engines/install.rb
codeclimate-0.64.0 lib/cc/cli/engines/install.rb
codeclimate-0.63.7 lib/cc/cli/engines/install.rb
codeclimate-0.63.6 lib/cc/cli/engines/install.rb
codeclimate-0.63.5 lib/cc/cli/engines/install.rb
codeclimate-0.63.4 lib/cc/cli/engines/install.rb
codeclimate-0.63.3 lib/cc/cli/engines/install.rb
codeclimate-0.63.2 lib/cc/cli/engines/install.rb
codeclimate-0.63.1 lib/cc/cli/engines/install.rb
codeclimate-0.63.0 lib/cc/cli/engines/install.rb
codeclimate-0.62.0 lib/cc/cli/engines/install.rb
codeclimate-0.61.1 lib/cc/cli/engines/install.rb
codeclimate-0.61.0 lib/cc/cli/engines/install.rb
codeclimate-0.60.1 lib/cc/cli/engines/install.rb
codeclimate-0.60.0 lib/cc/cli/engines/install.rb
codeclimate-0.59.1 lib/cc/cli/engines/install.rb