class Tainers::Specification::ImagePuller
Tainer specification that automatically pulls the image as needed prior to container creation operations.
Wrap it around a bare specification to use it:
t1 = Tainers::Specification::Bare.new('Image' =>' foo') t2 = Tainers::Specification::ImagePuller.new(t1) # This doesn't pull image "foo" t1.ensure # But this will, if necessary t2.ensure
Note that the ensure and create methods have the pulling behavior; no others do.
Public Class Methods
ensure_image(image)
click to toggle source
# File lib/tainers/specification.rb, line 132 def self.ensure_image(image) if ! Tainers::API.image_exists?(image) Tainers::API.pull_image image end true end
pulls_and_delegates(method_name)
click to toggle source
# File lib/tainers/specification.rb, line 139 def self.pulls_and_delegates(method_name) method_name = method_name.to_sym define_method(method_name) do |*args| self.class.ensure_image(chain.image) chain.send(method_name, *args) end end