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.59.0 lib/cc/cli/engines/install.rb
codeclimate-0.58.0 lib/cc/cli/engines/install.rb
codeclimate-0.57.0 lib/cc/cli/engines/install.rb
codeclimate-0.56.0 lib/cc/cli/engines/install.rb
codeclimate-0.55.0 lib/cc/cli/engines/install.rb
codeclimate-0.54.0 lib/cc/cli/engines/install.rb
codeclimate-0.53.0 lib/cc/cli/engines/install.rb
codeclimate-0.52.0 lib/cc/cli/engines/install.rb
codeclimate-0.51.3 lib/cc/cli/engines/install.rb
codeclimate-0.51.2 lib/cc/cli/engines/install.rb
codeclimate-0.51.1 lib/cc/cli/engines/install.rb
codeclimate-0.51.0 lib/cc/cli/engines/install.rb
codeclimate-0.50.0 lib/cc/cli/engines/install.rb
codeclimate-0.49.0 lib/cc/cli/engines/install.rb
codeclimate-0.48.0 lib/cc/cli/engines/install.rb
codeclimate-0.47.0 lib/cc/cli/engines/install.rb
codeclimate-0.46.0 lib/cc/cli/engines/install.rb