Sha256: 9e9db37c224219b1830637ca2b9aeedbc0a09dad827e5cca30a8bb40353807b9

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

module PredragsDummyPipelines

  class Pipeline
    attr_reader :build

    def initialize(actions)
      @build   = Exec.new(actions["build"], "build")
      deploys  = actions.select {|a,b| a != "build"}
      @deploys = deploys.map {|key, value| Exec.new(value, key)}
    end

    def run
      @build.run
      @deploys.map {|deploy|  deploy.run if success? }
    end

    def show
      puts @build.show
      @deploys.map {|deploy| puts deploy.show }
    end

    def build_results
      @build.results
    end

    def deploy_results
      @deploys.map {|deploy| deploy.results}
    end

    def success?
      @build.success? and @deploys.map {|deploy| deploy.success?}.all? {|estat| estat == true}
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
predrags_dummy_pipelines-0.8.5 lib/predrags_dummy_pipelines/pipeline.rb