def copy_file(self, file_name, output_directory): source_file_path = '{}/{}'.format(self.templates_path, file_name) output_file_path = self.root_path if output_directory != '': output_file_path += '/{}'.format(output_directory) output_file_path += '/{}'.format(file_name) source_content = read_file(source_file_path) write_file(output_file_path, source_content) print(output_file_path)
def output_file(self, file_name, output_directory, variables): template_file_path = '{}/{}.template'.format( self.templates_path, file_name) output_file_path = self.root_path if output_directory != '': output_file_path += '/{}'.format(output_directory) output_file_path += '/{}'.format(file_name) template_content = read_file(template_file_path) output_content = Template(template_content).substitute(variables) write_file(output_file_path, output_content) print(output_file_path)