Class: Rudder::DSL::Group
- Inherits:
-
Object
- Object
- Rudder::DSL::Group
- Defined in:
- lib/rudder/dsl/group.rb
Overview
Concourse group. Logically groups together Concourse jobs in the UI.
DSL Usage:
Group's are the simplest element of any Concourse Pipeline, defined by only a name and a non-empty list of jobs.
Instance Method Summary collapse
-
#initialize(name) ⇒ Group
constructor
All Group's require.
-
#job(job_name) ⇒ Set<String, Symbol>
Add a single job to the jobs list.
-
#jobs(*args) ⇒ Set<String, Symbol>
Adds all the jobs to the jobs list.
-
#name(name = nil) ⇒ String, Symbol
Replace's this Group's name unless
name
is nil. -
#to_h ⇒ Hash
YAML friendly
Hash
representation of this resource.
Constructor Details
#initialize(name) ⇒ Group
All Rudder::DSL::Group's require
-
Name of the group
-
A list of jobs in the group
Jobs are added after initilization.
53 54 55 56 57 58 |
# File 'lib/rudder/dsl/group.rb', line 53 def initialize(name) raise super.ArgumentError 'Name cannot be nil' if name.nil? @name = name @jobs = Set.new end |
Instance Method Details
#job(job_name) ⇒ Set<String, Symbol>
Add a single job to the jobs list
78 79 80 |
# File 'lib/rudder/dsl/group.rb', line 78 def job(job_name) jobs job_name end |
#jobs(*args) ⇒ Set<String, Symbol>
Adds all the jobs to the jobs list
89 90 91 92 |
# File 'lib/rudder/dsl/group.rb', line 89 def jobs(*args) args.each { |arg| @jobs << arg } @jobs end |
#name(name = nil) ⇒ String, Symbol
Replace's this Rudder::DSL::Group's name unless name
is nil.
67 68 69 70 |
# File 'lib/rudder/dsl/group.rb', line 67 def name(name = nil) @name = name unless name.nil? @name end |
#to_h ⇒ Hash
Returns YAML friendly Hash
representation of this resource
99 100 101 102 103 104 105 106 107 |
# File 'lib/rudder/dsl/group.rb', line 99 def to_h raise 'Groups require a name' if @name.nil? raise 'Groups require at least 1 job' if @jobs.empty? { 'name' => @name.to_s, 'jobs' => @jobs.to_a.map(&:to_s) } end |