Sha256: 858fa4a80d3243945f1c120cd915a9a8ef91c8c83aef2581b1ce1a426bd41562

Contents?: true

Size: 526 Bytes

Versions: 5

Compression:

Stored size: 526 Bytes

Contents

require 'rake'
require 'docker'

# This class allows image-based tasks to be created.
class Docker::ImageTask
  def needed?
    Docker::Image.all(:all => true).any? { |image|
      image['RepoTags'].include?(repo_tag)
    }
  end

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
docker-api-1.10.3 lib/docker/rake_task.rb
docker-api-1.10.2 lib/docker/rake_task.rb
docker-api-1.10.1 lib/docker/rake_task.rb
docker-api-1.10.0 lib/docker/rake_task.rb
docker-api-1.9.1 lib/docker/rake_task.rb