Sha256: 4a621a07bfa81791dc9dccac90407c71e002e826c68a5e5812784920d4dda913

Contents?: true

Size: 1005 Bytes

Versions: 30

Compression:

Stored size: 1005 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)
          if !system("docker pull #{engine_image}")
            raise ImagePullFailure, "unable to pull image #{engine_image}"
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
codeclimate-0.9.7 lib/cc/cli/engines/install.rb
codeclimate-0.9.6 lib/cc/cli/engines/install.rb
codeclimate-0.9.5 lib/cc/cli/engines/install.rb
codeclimate-0.9.4 lib/cc/cli/engines/install.rb
codeclimate-0.9.3 lib/cc/cli/engines/install.rb
codeclimate-0.9.2 lib/cc/cli/engines/install.rb
codeclimate-0.9.1 lib/cc/cli/engines/install.rb
codeclimate-0.9.0 lib/cc/cli/engines/install.rb
codeclimate-0.8.1 lib/cc/cli/engines/install.rb
codeclimate-0.8.0 lib/cc/cli/engines/install.rb
codeclimate-0.7.2 lib/cc/cli/engines/install.rb
codeclimate-0.7.0 lib/cc/cli/engines/install.rb
codeclimate-0.6.4 lib/cc/cli/engines/install.rb
codeclimate-0.6.3 lib/cc/cli/engines/install.rb
codeclimate-0.6.2 lib/cc/cli/engines/install.rb
codeclimate-0.6.1 lib/cc/cli/engines/install.rb
codeclimate-0.6.0 lib/cc/cli/engines/install.rb
codeclimate-0.5.0 lib/cc/cli/engines/install.rb
codeclimate-0.4.4 lib/cc/cli/engines/install.rb
codeclimate-0.4.3 lib/cc/cli/engines/install.rb