Class: LogicalConstruct::TemplateFile

Inherits:
Mattock::TaskLib
  • Object
show all
Includes:
Mattock::DeferredDefinition, Mattock::TemplateHost
Defined in:
lib/logical-construct/template-file.rb

Instance Method Summary collapse

Instance Method Details

#default_configuration(host) ⇒ Object



16
17
18
19
# File 'lib/logical-construct/template-file.rb', line 16

def default_configuration(host)
  super
  host.copy_settings_to(self)
end

#defineObject



32
33
34
35
36
37
38
39
# File 'lib/logical-construct/template-file.rb', line 32

def define
  file target.absolute_path => [target_dir, templates.find(base_name).full_path, Rake.application.rakefile] do
    finalize_configuration
    File::open(target.absolute_path, "w") do |file|
      file.write templates.find(base_name).contents.render(nil, extra)
    end
  end
end

#resolve_configurationObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/logical-construct/template-file.rb', line 21

def resolve_configuration
  target.relative_path ||= base_name
  resolve_paths

  if field_unset?(:templates)
    self.templates = fail_unless_set(:valise) && valise.templates
  end

  super
end