Created
October 22, 2009 13:33
-
-
Save briandonahue/215946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def expand_template( template_file, output_file) | |
puts "Building #{output_file}" | |
template = File.open(template_file, "r") | |
output = File.open(output_file, "w") | |
template.each_line do |template_line| | |
template_line.gsub(/@([^@]+)@/) do |token| | |
value = @config[$1.downcase] | |
unless value.nil? | |
template_line = template_line.gsub(token, value.to_s) | |
end | |
end | |
output.write(template_line) | |
end | |
template.close | |
output.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment