Sha256: 7042f7fea1c860b1a4fba81a0a7bab676b2c8aa608f3276ce77849e2c84f323e

Contents?: true

Size: 1.23 KB

Versions: 30

Compression:

Stored size: 1.23 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.
      Tasks::Builder.new(options).build
      Tasks::Register.register(task_definition, options)
    end

    def initialize(options={})
      @options = options
    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("#{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

30 entries across 30 versions & 1 rubygems

Version Path
ufo-4.1.1 lib/ufo/tasks/builder.rb
ufo-4.1.0 lib/ufo/tasks/builder.rb
ufo-4.0.3 lib/ufo/tasks/builder.rb
ufo-4.0.2 lib/ufo/tasks/builder.rb
ufo-4.0.1 lib/ufo/tasks/builder.rb
ufo-4.0.0 lib/ufo/tasks/builder.rb
ufo-3.5.7 lib/ufo/tasks/builder.rb
ufo-3.5.6 lib/ufo/tasks/builder.rb
ufo-3.5.5 lib/ufo/tasks/builder.rb
ufo-3.5.4 lib/ufo/tasks/builder.rb
ufo-3.5.3 lib/ufo/tasks/builder.rb
ufo-3.5.2 lib/ufo/tasks/builder.rb
ufo-3.5.1 lib/ufo/tasks/builder.rb
ufo-3.5.0 lib/ufo/tasks/builder.rb
ufo-3.4.4 lib/ufo/tasks/builder.rb
ufo-3.4.3 lib/ufo/tasks/builder.rb
ufo-3.4.2 lib/ufo/tasks/builder.rb
ufo-3.4.1 lib/ufo/tasks/builder.rb
ufo-3.4.0 lib/ufo/tasks/builder.rb
ufo-3.3.2 lib/ufo/tasks/builder.rb