Module: EasyInstaller::InstallHelper::Template

Defined in:
lib/easy_installer/install_helpers/template.rb

Instance Method Summary collapse

Instance Method Details

#define_template(filename) ⇒ Object



5
6
7
8
9
10
# File 'lib/easy_installer/install_helpers/template.rb', line 5

def define_template( filename )
  @_templates = [] unless @_templates
  @_templates << {
    :filename => filename,
    :erb => ERB.new(File.read(filename))}
end

#save_templatesObject



12
13
14
15
16
# File 'lib/easy_installer/install_helpers/template.rb', line 12

def save_templates
  @_templates.each{|template| 
    File.open(template[:filename],"w"){|f| 
      f.write(template[:erb].result(binding))}}
end