class Mattock::TemplateTask
Public Instance Methods
action(args)
click to toggle source
# 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)
click to toggle source
Calls superclass method
# 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()
click to toggle source
Calls superclass method
Mattock::ConfigurableTask#resolve_configuration
# 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