Class: Rake::Delphi::RCTemplateTask
- Inherits:
-
Task
- Object
- Task
- Rake::Delphi::RCTemplateTask
show all
- Defined in:
- lib/rake/delphi/resources.rb
Instance Attribute Summary
Attributes inherited from Task
#logger
Instance Method Summary
collapse
Methods inherited from Task
#execute_base, #initialize_base, #out, #shortname, #trace?
Constructor Details
Returns a new instance of RCTemplateTask.
72
73
74
75
76
77
|
# File 'lib/rake/delphi/resources.rb', line 72
def initialize(name, app)
super
@output = nil
@template_file = File.expand_path('../../templates/project.erb', __FILE__)
@template_obj = RCTemplate.new(self)
end
|
Instance Method Details
#[]=(key, value) ⇒ Object
83
84
85
|
# File 'lib/rake/delphi/resources.rb', line 83
def []=(key, value)
@template_obj[key] = value
end
|
#execute(args = nil) ⇒ Object
87
88
89
90
91
92
93
|
# File 'lib/rake/delphi/resources.rb', line 87
def execute(args=nil)
erb = ERB.new(IO.read(@template_file))
text = erb.result(@template_obj.get_binding)
File.open(@output, 'w') do |f|
f.write(text)
end
end
|
#output=(value) ⇒ Object
79
80
81
|
# File 'lib/rake/delphi/resources.rb', line 79
def output=(value)
@output = value.pathmap('%X.rc')
end
|