Sha256: 461b2b8520bb53ce5081d15e2b6d3d8d3027b649d7119a4e3fd5dceaae7601c9

Contents?: true

Size: 1.35 KB

Versions: 23

Compression:

Stored size: 1.35 KB

Contents

module Ufo
  class Tasks::Builder
    # ship: build and registers task definitions together
    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)
      Tasks::Register.register(task_definition, options)
    end

    # ship: build and registers task definitions together
    def self.build(options)
      Tasks::Builder.new(options).build
    end

    def initialize(options={})
      @options = options
    end

    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

    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

    def template_definitions_path
      "#{Ufo.root}/.ufo/task_definitions.rb"
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ufo-4.6.3 lib/ufo/tasks/builder.rb
ufo-4.6.2 lib/ufo/tasks/builder.rb
ufo-4.6.1 lib/ufo/tasks/builder.rb
ufo-4.6.0 lib/ufo/tasks/builder.rb
ufo-4.5.11 lib/ufo/tasks/builder.rb
ufo-4.5.10 lib/ufo/tasks/builder.rb
ufo-4.5.9 lib/ufo/tasks/builder.rb
ufo-4.5.8 lib/ufo/tasks/builder.rb
ufo-4.5.7 lib/ufo/tasks/builder.rb
ufo-4.5.6 lib/ufo/tasks/builder.rb
ufo-4.5.5 lib/ufo/tasks/builder.rb
ufo-4.5.4 lib/ufo/tasks/builder.rb
ufo-4.5.3 lib/ufo/tasks/builder.rb
ufo-4.5.2 lib/ufo/tasks/builder.rb
ufo-4.5.1 lib/ufo/tasks/builder.rb
ufo-4.5.0 lib/ufo/tasks/builder.rb
ufo-4.4.3 lib/ufo/tasks/builder.rb
ufo-4.4.2 lib/ufo/tasks/builder.rb
ufo-4.4.1 lib/ufo/tasks/builder.rb
ufo-4.4.0 lib/ufo/tasks/builder.rb