Class: Ufo::Tasks::Builder
- Inherits:
-
Object
- Object
- Ufo::Tasks::Builder
- Defined in:
- lib/ufo/tasks/builder.rb
Class Method Summary collapse
-
.ship(task_definition, options) ⇒ Object
ship: build and registers task definitions together.
Instance Method Summary collapse
- #build ⇒ Object
- #check_templates_definitions_path ⇒ Object
-
#initialize(options = {}) ⇒ Builder
constructor
A new instance of Builder.
- #template_definitions_path ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Builder
Returns a new instance of Builder.
12 13 14 |
# File 'lib/ufo/tasks/builder.rb', line 12 def initialize(={}) @options = end |
Class Method Details
.ship(task_definition, options) ⇒ Object
ship: build and registers task definitions together
4 5 6 7 8 9 10 |
# File 'lib/ufo/tasks/builder.rb', line 4 def self.ship(task_definition, ) # 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().build Tasks::Register.register(task_definition, ) end |
Instance Method Details
#build ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ufo/tasks/builder.rb', line 16 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
24 25 26 27 28 29 30 |
# File 'lib/ufo/tasks/builder.rb', line 24 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 |