Class: Shipitron::PostBuild

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/shipitron/post_build.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(str) ⇒ Object

String is of the format: ‘ecs_task:task,container_name:name,command:command



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/shipitron/post_build.rb', line 11

def self.parse(str)
  PostBuild.new.tap do |post_build|
    str.split(',').each do |part|
      part.match(/([^:]+):(.+)/) do |m|
        prop = m[1].to_sym
        if property?(prop)
          post_build[prop] = m[2]
        end
      end
    end

    properties.each do |prop|
      raise "post build argument missing '#{prop}'" if post_build[prop].nil?
    end
  end
end

Instance Method Details

#command_aryObject



32
33
34
# File 'lib/shipitron/post_build.rb', line 32

def command_ary
  command.split(' ')
end

#to_sObject



28
29
30
# File 'lib/shipitron/post_build.rb', line 28

def to_s
  "ecs_task:#{ecs_task},container_name:#{container_name},command:#{command}"
end