Create and fill the header of a unit file file.

A unit file is a Nit source file generated from one or more docunits that will be compiled and executed.

The handled on the file is returned and must be completed and closed.

file should be a valid filepath for a Nit source file.

Property definitions

nitc $ NitUnitExecutor :: create_unitfile
	# Create and fill the header of a unit file `file`.
	#
	# A unit file is a Nit source file generated from one
	# or more docunits that will be compiled and executed.
	#
	# The handled on the file is returned and must be completed and closed.
	#
	# `file` should be a valid filepath for a Nit source file.
	private fun create_unitfile(file: String): Writer
	do
		var mmodule = self.mmodule
		var dir = file.dirname
		if dir != "" then dir.mkdir
		var f
		f = new FileWriter.open(file)
		f.write("# GENERATED FILE\n")
		f.write("# Docunits extracted from comments\n")
		if mmodule != null then
			f.write("intrude import {mmodule.name}\n")
		end
		f.write("\n")
		return f
	end
src/testing/testing_doc.nit:267,2--289,4