Sha256: 1cc3add3764ac00232e215ae85ae7697259b1d2e7929badd5e8490b520cd5f0a

Contents?: true

Size: 1.4 KB

Versions: 15

Compression:

Stored size: 1.4 KB

Contents

module Ufo
  class Tasks::Builder
    # build and registers together
    def self.register(task_definition, options)
      # task definition and deploy logic are coupled in the Ship class.
      # Example: We need to know if the task defintion is a web service to see if we need to
      # add the elb target group.  The web service information is in the Tasks::Builder
      # and the elb target group gets set in the Ship class.
      # So we always call these together.
      Tasks::Builder.new(options).build
      Tasks::Register.register(task_definition, options)
    end

    def initialize(options={})
      @options = options
      @project_root = options[:project_root] || '.'
    end

    def build
      puts "Building Task Definitions...".green unless @options[:mute]
      check_templates_definitions_path
      dsl = DSL.new(template_definitions_path, @options.merge(quiet: false, mute: true))
      dsl.run
      puts "Task Definitions built in ufo/output." unless @options[:mute]
    end

    def check_templates_definitions_path
      unless File.exist?(template_definitions_path)
        pretty_path = template_definitions_path.sub("#{@project_root}/", '')
        puts "ERROR: #{pretty_path} does not exist.  Run: `ufo init` to create a starter file" unless @options[:mute]
        exit 1
      end
    end

    def template_definitions_path
      "#{@project_root}/ufo/task_definitions.rb"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ufo-2.3.0 lib/ufo/tasks/builder.rb
ufo-2.2.2 lib/ufo/tasks/builder.rb
ufo-2.2.1 lib/ufo/tasks/builder.rb
ufo-2.2.0 lib/ufo/tasks/builder.rb
ufo-2.1.0 lib/ufo/tasks/builder.rb
ufo-2.0.3 lib/ufo/tasks/builder.rb
ufo-2.0.2 lib/ufo/tasks/builder.rb
ufo-2.0.1 lib/ufo/tasks/builder.rb
ufo-2.0.0 lib/ufo/tasks/builder.rb
ufo-1.7.1 lib/ufo/tasks/builder.rb
ufo-1.7.0 lib/ufo/tasks/builder.rb
ufo-1.6.2 lib/ufo/tasks/builder.rb
ufo-1.6.1 lib/ufo/tasks/builder.rb
ufo-1.6.0 lib/ufo/tasks/builder.rb
ufo-1.5.0 lib/ufo/tasks/builder.rb