# File lib/rails-installer.rb, line 618
  def expand_template_files
    rails_host = config['bind-address'] || `hostname`.chomp
    rails_port = config['port-number'].to_s
    rails_url = "http://#{rails_host}:#{rails_port}"
    Dir[File.join(install_directory,'installer','*.template')].each do |template_file|
      output_file = template_file.gsub(/\.template/,'')
      next if File.exists?(output_file) # don't overwrite files

      message "expanding #{File.basename(output_file)} template"
      
      text = File.read(template_file).gsub(/\$RAILS_URL/,rails_url).gsub(/\$RAILS_HOST/,rails_host).gsub(/\$RAILS_PORT/,rails_port)
      
      File.open(output_file,'w') do |f|
        f.write text
      end
    end
  end