Class: Blubber::Flow

Inherits:
Object
  • Object
show all
Defined in:
lib/blubber/flow.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(layer:) ⇒ Flow

Returns a new instance of Flow.



24
25
26
# File 'lib/blubber/flow.rb', line 24

def initialize(layer:)
  @layer = layer
end

Class Method Details

.build(layers = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/blubber/flow.rb', line 9

def self.build(layers = nil)
  layers ||= Dir['**/*/Dockerfile'].map { |d| File.dirname(d) }

  images = layers.map { |layer| Flow.new(layer: layer).run }

  table = [HighLine.color('Layer', :bold), HighLine.color('Tag', :bold)]
  table += images.map do |(project, tags)|
    tags.map do |tag|
      [project, tag ]
    end
  end

  puts HighLine.new.list(table.flatten, :columns_across, 2)
end

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
# File 'lib/blubber/flow.rb', line 29

def run
  image = Builder.new(layer: layer, logger: logger).run
  return unless image[:success]

  tagger = Tagger.new(layer: layer, image_id: image[:id], logger: logger)
  tagger.run

  [tagger.project, tagger.tags]
end