class Pipedream::Pipeline
Public Class Methods
new(options={})
click to toggle source
# File lib/pipedream/pipeline.rb, line 7 def initialize(options={}) @options = options @pipeline_path = options[:pipeline_path] || get_pipeline_path @properties = default_properties # defaults make pipeline.rb simpler @stages = [] end
Public Instance Methods
default_properties()
click to toggle source
# File lib/pipedream/pipeline.rb, line 28 def default_properties { name: @options[:full_pipeline_name], role_arn: { "Fn::GetAtt": "IamRole.Arn" }, artifact_store: { type: "S3", location: s3_bucket, # auto creates s3 bucket } } end
exist?()
click to toggle source
# File lib/pipedream/pipeline.rb, line 48 def exist? File.exist?(@pipeline_path) end
run()
click to toggle source
# File lib/pipedream/pipeline.rb, line 14 def run evaluate(@pipeline_path) @properties[:stages] ||= @stages set_source_branch! resource = { pipeline: { type: "AWS::CodePipeline::Pipeline", properties: @properties } } CfnCamelizer.transform(resource) end
s3_bucket()
click to toggle source
# File lib/pipedream/pipeline.rb, line 52 def s3_bucket S3Bucket.name end
set_source_branch!()
click to toggle source
cli branch option always takes highest precedence
# File lib/pipedream/pipeline.rb, line 40 def set_source_branch! return unless @options[:branch] source_stage = @properties[:stages].first action = source_stage[:actions].first action[:configuration][:branch] = @options[:branch] end
Private Instance Methods
get_pipeline_path()
click to toggle source
# File lib/pipedream/pipeline.rb, line 57 def get_pipeline_path lookup_pipedream_file "pipeline.rb" end