Sha256: 63ea795762ac22e5fd11e4318758e088c296e33befb5e2c720c855f8faa0efe4

Contents?: true

Size: 655 Bytes

Versions: 71

Compression:

Stored size: 655 Bytes

Contents

# This class allows image-based tasks to be created.
class Docker::ImageTask < Rake::Task
  def self.scope_name(_scope, task_name)
    task_name
  end

  def needed?
    !has_repo_tag?
  end

  private

  def has_repo_tag?
    images.any? { |image| image.info['RepoTags'].include?(repo_tag) }
  end

  def images
    @images ||= Docker::Image.all(:all => true)
  end

  def repo
    name.split(':')[0]
  end

  def tag
    name.split(':')[1] || 'latest'
  end

  def repo_tag
    "#{repo}:#{tag}"
  end
end

# Monkeypatch Rake to add the `image` task.
module Rake::DSL
  def image(*args, &block)
    Docker::ImageTask.define_task(*args, &block)
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
docker-api-2.3.0 lib/docker/rake_task.rb
docker-api-2.2.0 lib/docker/rake_task.rb
docker-api-2.1.0 lib/docker/rake_task.rb
docker-api-2.0.0 lib/docker/rake_task.rb
docker-api-2.0.0.pre.1 lib/docker/rake_task.rb
docker-api-1.34.2 lib/docker/rake_task.rb
docker-api-1.34.1 lib/docker/rake_task.rb
docker-api-1.34.0 lib/docker/rake_task.rb
docker-api-1.33.6 lib/docker/rake_task.rb
docker-api-1.33.5 lib/docker/rake_task.rb
docker-api-1.33.4 lib/docker/rake_task.rb
docker-api-1.33.3 lib/docker/rake_task.rb
docker-api-1.33.2 lib/docker/rake_task.rb
docker-api-1.33.1 lib/docker/rake_task.rb
docker-api-1.33.0 lib/docker/rake_task.rb
docker-api-1.32.1 lib/docker/rake_task.rb
docker-api-1.32.0 lib/docker/rake_task.rb
docker-api-1.31.0 lib/docker/rake_task.rb
docker-api-1.30.2 lib/docker/rake_task.rb
docker-api-1.30.1 lib/docker/rake_task.rb