Class: Ufo::TasksBuilder
- Inherits:
-
Object
- Object
- Ufo::TasksBuilder
- Defined in:
- lib/ufo/tasks_builder.rb
Instance Method Summary collapse
- #build ⇒ Object
- #check_templates_definitions_path ⇒ Object
-
#initialize(options = {}) ⇒ TasksBuilder
constructor
A new instance of TasksBuilder.
- #template_definitions_path ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ TasksBuilder
Returns a new instance of TasksBuilder.
5 6 7 8 |
# File 'lib/ufo/tasks_builder.rb', line 5 def initialize(={}) @options = @project_root = [:project_root] || '.' end |
Instance Method Details
#build ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/ufo/tasks_builder.rb', line 10 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 |
#check_templates_definitions_path ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/ufo/tasks_builder.rb', line 18 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 |
#template_definitions_path ⇒ Object
26 27 28 |
# File 'lib/ufo/tasks_builder.rb', line 26 def template_definitions_path "#{@project_root}/ufo/task_definitions.rb" end |