Sha256: 55e70e9a22c76787c2af0ac0ea7249503ffd1ec35f2eaa03f22b8c20a01aae60

Contents?: true

Size: 835 Bytes

Versions: 18

Compression:

Stored size: 835 Bytes

Contents

require 'shipitron'

module Shipitron
  class PostBuild < Hashie::Dash
    property :ecs_task
    property :container_name
    property :command

    # String is of the format:
    # 'ecs_task:task,container_name:name,command:command
    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

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

    def command_ary
      command.split(' ')
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
shipitron-1.4.1 lib/shipitron/post_build.rb
shipitron-1.4.0 lib/shipitron/post_build.rb
shipitron-1.3.2 lib/shipitron/post_build.rb
shipitron-1.3.1 lib/shipitron/post_build.rb
shipitron-1.3.0 lib/shipitron/post_build.rb
shipitron-1.2.1 lib/shipitron/post_build.rb
shipitron-1.2.0 lib/shipitron/post_build.rb
shipitron-1.1.0 lib/shipitron/post_build.rb
shipitron-1.0.1 lib/shipitron/post_build.rb
shipitron-1.0.0 lib/shipitron/post_build.rb
shipitron-0.4.1 lib/shipitron/post_build.rb
shipitron-0.4.0 lib/shipitron/post_build.rb
shipitron-0.3.5 lib/shipitron/post_build.rb
shipitron-0.3.4 lib/shipitron/post_build.rb
shipitron-0.3.3 lib/shipitron/post_build.rb
shipitron-0.3.1 lib/shipitron/post_build.rb
shipitron-0.3.0 lib/shipitron/post_build.rb
shipitron-0.2.2 lib/shipitron/post_build.rb