Class: Pipely::Build::Definition
- Inherits:
-
Struct
- Object
- Struct
- Pipely::Build::Definition
- Extended by:
- Forwardable
- Defined in:
- lib/pipely/build/definition.rb
Overview
Represent a pipeline definition, built from a Template and some config.
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#env ⇒ Object
Returns the value of attribute env.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #base_filename ⇒ Object
- #pipeline_name ⇒ Object
- #s3_path_builder ⇒ Object
- #s3_prefix ⇒ Object
- #scheduler ⇒ Object
- #to_json ⇒ Object
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config
6 7 8 |
# File 'lib/pipely/build/definition.rb', line 6 def config @config end |
#env ⇒ Object
Returns the value of attribute env
6 7 8 |
# File 'lib/pipely/build/definition.rb', line 6 def env @env end |
#template ⇒ Object
Returns the value of attribute template
6 7 8 |
# File 'lib/pipely/build/definition.rb', line 6 def template @template end |
Instance Method Details
#base_filename ⇒ Object
15 16 17 |
# File 'lib/pipely/build/definition.rb', line 15 def base_filename config[:namespace] end |
#pipeline_name ⇒ Object
11 12 13 |
# File 'lib/pipely/build/definition.rb', line 11 def pipeline_name config[:name] end |
#s3_path_builder ⇒ Object
28 29 30 |
# File 'lib/pipely/build/definition.rb', line 28 def s3_path_builder S3PathBuilder.new(config[:s3].merge(prefix: s3_prefix)) end |
#s3_prefix ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/pipely/build/definition.rb', line 19 def s3_prefix if config[:s3_prefix] template = Pathology.template(config[:s3_prefix]) template.interpolate(interpolation_context) else fail('unspecified s3_prefix') end end |
#scheduler ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/pipely/build/definition.rb', line 41 def scheduler case config[:scheduler] when 'daily' DailyScheduler.new(config[:start_time]) when 'now' RightNowScheduler.new when 'hourly' HourlyScheduler.new else fail('unspecified scheduler') end end |
#to_json ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/pipely/build/definition.rb', line 32 def to_json template.apply_config(:environment => env) template.apply_config(config) template.apply_config(s3_path_builder.to_hash) template.apply_config(scheduler.to_hash) template.to_json end |