Class: Mattock::TemplateTask
Instance Attribute Summary
#base_task
Instance Method Summary
collapse
included, #inspect
add_settings, #finalize_configuration, #resolve_runtime_configuration, #runtime?, #runtime_definition, #setup_deferred
#confirm_configuration, #confirm_step, #confirm_steps, #define, #setup_cascade
Instance Method Details
#action(args) ⇒ Object
45
46
47
48
49
|
# File 'lib/mattock/template-task.rb', line 45
def action(args)
File::open(target.absolute_path, "w") do |target|
target.write(templates.find(source_path).contents.render(context, local_variables))
end
end
|
#default_configuration(context) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/mattock/template-task.rb', line 13
def default_configuration(context)
super
self.context = context
if field_unset?(:task_name)
unless field_unset?(:source_path)
target.relative_path = source_path
end
end
end
|
#resolve_configuration ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/mattock/template-task.rb', line 25
def resolve_configuration
if field_unset?(:source_path)
self.source_path = File::basename(task_name)
end
if target.field_unset?(:relative_path)
target.absolute_path = task_name
end
self.templates ||=
begin
require 'valise'
Valise::read_only(*search_dirs).templates
end
resolve_paths
super
end
|