Sha256: 78f4d56b0444ebf20048e6d7177739638522dfffed1ab9af5337f219ad38efad

Contents?: true

Size: 1008 Bytes

Versions: 59

Compression:

Stored size: 1008 Bytes

Contents

module CC
  module CLI
    module Engines
      class Install < EngineCommand
        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)
              image = engine_image(name)
              pull_engine_image(image)
            else
              warn("unknown engine name: #{name}")
            end
          end
        end

        def engine_names
          @engine_names ||= parsed_yaml.engine_names
        end

        def engine_image(engine_name)
          engine_registry_list[engine_name]["image"]
        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

59 entries across 59 versions & 1 rubygems

Version Path
codeclimate-0.29.0 lib/cc/cli/engines/install.rb
codeclimate-0.28.0 lib/cc/cli/engines/install.rb
codeclimate-0.27.2 lib/cc/cli/engines/install.rb
codeclimate-0.27.1 lib/cc/cli/engines/install.rb
codeclimate-0.27.0 lib/cc/cli/engines/install.rb
codeclimate-0.27.0.rc1 lib/cc/cli/engines/install.rb
codeclimate-0.26.0 lib/cc/cli/engines/install.rb
codeclimate-0.25.1 lib/cc/cli/engines/install.rb
codeclimate-0.25.0 lib/cc/cli/engines/install.rb
codeclimate-0.24.3 lib/cc/cli/engines/install.rb
codeclimate-0.24.2 lib/cc/cli/engines/install.rb
codeclimate-0.24.1 lib/cc/cli/engines/install.rb
codeclimate-0.24.0 lib/cc/cli/engines/install.rb
codeclimate-0.23.0 lib/cc/cli/engines/install.rb
codeclimate-0.22.3 lib/cc/cli/engines/install.rb
codeclimate-0.22.2 lib/cc/cli/engines/install.rb
codeclimate-0.22.1 lib/cc/cli/engines/install.rb
codeclimate-0.22.0 lib/cc/cli/engines/install.rb
codeclimate-0.21.4 lib/cc/cli/engines/install.rb
codeclimate-0.21.3 lib/cc/cli/engines/install.rb