Class: DockerTools::Dependency
- Inherits:
-
Object
- Object
- DockerTools::Dependency
- Defined in:
- lib/docker_tools/dependency.rb
Instance Method Summary collapse
-
#initialize(name, registry, tag, fallback_tag) ⇒ Dependency
constructor
A new instance of Dependency.
- #run ⇒ Object
Constructor Details
#initialize(name, registry, tag, fallback_tag) ⇒ Dependency
Returns a new instance of Dependency.
10 11 12 13 14 15 |
# File 'lib/docker_tools/dependency.rb', line 10 def initialize(name, registry, tag, fallback_tag) @name = name @registry = registry @tag = tag @fallback_tag = fallback_tag end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/docker_tools/dependency.rb', line 17 def run tag = @tag image = DockerTools::Image.new(@name, @registry, @tag) begin image.pull rescue puts "Falling back to image #{@registry}/#{@name}:#{@fallback_tag}" image = DockerTools::Image.new(@name, @registry, @fallback_tag) image.pull throw "Cannot find image" if image.image.nil? tag = @fallback_tag end tag end |