Sha256: 5c096f2b50c04f972ebc6ef1cf8be387775b9a019c2fe79ec33ba0a9b17995a5

Contents?: true

Size: 910 Bytes

Versions: 11

Compression:

Stored size: 910 Bytes

Contents

module Ufo
  autoload :DSL, 'ufo/dsl'

  class TasksBuilder
    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

11 entries across 11 versions & 1 rubygems

Version Path
ufo-1.2.0 lib/ufo/tasks_builder.rb
ufo-1.1.0 lib/ufo/tasks_builder.rb
ufo-1.0.1 lib/ufo/tasks_builder.rb
ufo-1.0.0 lib/ufo/tasks_builder.rb
ufo-0.1.6 lib/ufo/tasks_builder.rb
ufo-0.1.5 lib/ufo/tasks_builder.rb
ufo-0.1.4 lib/ufo/tasks_builder.rb
ufo-0.1.3 lib/ufo/tasks_builder.rb
ufo-0.1.2 lib/ufo/tasks_builder.rb
ufo-0.1.1 lib/ufo/tasks_builder.rb
ufo-0.1.0 lib/ufo/tasks_builder.rb