class Ufo::Tasks::Builder

Public Class Methods

build(options) click to toggle source

ship: build and registers task definitions together

# File lib/ufo/tasks/builder.rb, line 12
def self.build(options)
  Tasks::Builder.new(options).build
end
new(options={}) click to toggle source
# File lib/ufo/tasks/builder.rb, line 16
def initialize(options={})
  @options = options
end
ship(task_definition, options) click to toggle source

ship: build and registers task definitions together

# File lib/ufo/tasks/builder.rb, line 4
def self.ship(task_definition, options)
  # When handling task definitions in with the ship command and class, we always want to
  # build and register task definitions. There is little point of running them independently
  # This method helps us do that.
  build(options)
end

Public Instance Methods

build() click to toggle source
# File lib/ufo/tasks/builder.rb, line 20
def build
  puts "Building Task Definitions...".color(: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
check_templates_definitions_path() click to toggle source
# File lib/ufo/tasks/builder.rb, line 28
def check_templates_definitions_path
  unless File.exist?(template_definitions_path)
    pretty_path = template_definitions_path.sub("#{Ufo.root}/", '')
    puts "ERROR: #{pretty_path} does not exist.  Run: `ufo init` to create a starter file" unless @options[:mute]
    exit 1
  end
end
template_definitions_path() click to toggle source
# File lib/ufo/tasks/builder.rb, line 36
def template_definitions_path
  "#{Ufo.root}/.ufo/task_definitions.rb"
end