Class: Buildkite::Pipeline
- Inherits:
-
Object
- Object
- Buildkite::Pipeline
- Defined in:
- lib/buildkite.rb
Overview
Here is a comment.
Instance Method Summary collapse
- #add_agent(key, value) ⇒ Object
- #add_environment_variable(key, value) ⇒ Object
- #add_notify(notify) ⇒ Object
-
#add_step(step) ⇒ self
Adds a step to the pipeline.
- #build ⇒ Object
-
#initialize ⇒ Pipeline
constructor
A new instance of Pipeline.
- #to_json(*_args) ⇒ Object
- #to_yaml ⇒ Object
Constructor Details
#initialize ⇒ Pipeline
Returns a new instance of Pipeline.
11 12 13 14 15 16 |
# File 'lib/buildkite.rb', line 11 def initialize @steps = [] @agents = nil @env = nil @notify = nil end |
Instance Method Details
#add_agent(key, value) ⇒ Object
18 19 20 21 |
# File 'lib/buildkite.rb', line 18 def add_agent(key, value) @agents = {} if @agents.nil? @agents[key] = value end |
#add_environment_variable(key, value) ⇒ Object
23 24 25 26 |
# File 'lib/buildkite.rb', line 23 def add_environment_variable(key, value) @env = {} if @env.nil? @env[key] = value end |
#add_notify(notify) ⇒ Object
28 29 30 |
# File 'lib/buildkite.rb', line 28 def add_notify(notify) @notify = notify end |
#add_step(step) ⇒ self
Adds a step to the pipeline.
46 47 48 49 |
# File 'lib/buildkite.rb', line 46 def add_step(step) @steps << step self end |
#build ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/buildkite.rb', line 51 def build pipeline = { "steps" => @steps } pipeline["agents"] = @agents unless @agents.nil? pipeline["env"] = @env unless @env.nil? pipeline["notify"] = @notify unless @notify.nil? pipeline end |
#to_json(*_args) ⇒ Object
61 62 63 |
# File 'lib/buildkite.rb', line 61 def to_json(*_args) JSON.pretty_generate(build, indent: " ") end |
#to_yaml ⇒ Object
65 66 67 |
# File 'lib/buildkite.rb', line 65 def to_yaml build.to_yaml end |