class Pipely::Build::Definition

Represent a pipeline definition, built from a Template and some config.

Public Instance Methods

base_filename() click to toggle source
# File lib/pipely/build/definition.rb, line 15
def base_filename
  config[:namespace]
end
pipeline_name() click to toggle source
# File lib/pipely/build/definition.rb, line 11
def pipeline_name
  config[:name]
end
s3_path_builder() click to toggle source
# File lib/pipely/build/definition.rb, line 28
def s3_path_builder
  S3PathBuilder.new(config[:s3].merge(prefix: s3_prefix))
end
s3_prefix() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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

Private Instance Methods

interpolation_context() click to toggle source
# File lib/pipely/build/definition.rb, line 56
def interpolation_context
  config.merge({
    :whoami => `whoami`.strip,
  })
end