Sha256: 988ea561b76fe4dd05fc43c279116782084526f39f197bbf79e7af7d7593e9a5

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

require "pipelines/version"
require "pipelines/exec"
require "psych"

module Pipelines
  # Your code goes here...

  def self.build
    Exec.new(parse_["build"])
  end
  def self.parse_
    parse("project/simple.yml")
  end
  def self.parse(file)
    project = Psych.load_file(file)
  end


  class Pipeline
    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  }
    end

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

a = Pipelines.parse_
e = Pipelines::Pipeline.new a
e.run
e.show

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
predrags_dummy_pipelines-0.2.0 lib/pipelines.rb