Creating a project
In the Open Engineering Language, one command creates a ready-to-build project: oel init.
Usage
oel init <name>
oel init <name> --template <template>
| Argument or option | Meaning |
|---|---|
<name> | The project's name. It becomes the name of the new folder and is recorded in metadata.oel. |
--template <template> | Start from a template instead of the minimal project. |
--json | A machine-readable report of what was created. |
What it creates
oel init support creates a folder named support in the current folder, holding the three files every project has at its root:
support/
main.oel # main support(): the program's entry point
pack.oel # the packages the project uses; empty
metadata.oel # the project's name and settings
main.oeldeclares amainthat carries the name you gave and does nothing, so the new project checks, builds and runs as it is:
# main.oel
main support() {
return;
}
pack.oeldeclares no packages. It stays in the project even while it is empty:
# pack.oel
pack { schema = 1; dependencies = []; }
metadata.oelrecords the name you gave, which namesmainand the program thatoel buildwrites, and the source profile of the project:
# metadata.oel
metadata {
schema = 1;
name = "support";
source_profile = "oel-source/1";
}
The new project is a console program. It opens no network port and adds no server; you add the HTTP package and declare routes only when you want it to serve an API, as Services and APIs shows. A new project has no pack.lock and no .package folder: they appear beside pack.oel when you add the first package with oel pack add.
Every other folder and file is your choice. Project layout shows a larger project.
Names
A project name is an identifier:
- letters, digits and
_, not starting with a digit; - at most 64 characters;
- not a keyword, not
_on its own and not the reserved nameprint; - not
main: the name followsmaininmain.oel, andoel init mainis refused, as an entry namedmainis.
Names are case-sensitive, but oel init refuses a folder name that differs only in letter case from one already beside it, and names that some operating systems reserve for devices, so the new folder means the same thing on every operating system.
It never overwrites
- If a file or folder with the project's name already exists,
oel initstops and changes nothing. - The files are prepared beside the new folder, and the folder appears only when all three are complete. You never find a project with one of its root files missing.
- If it is interrupted, it reports anything it left behind, so you can remove it.
A project for a package
The same project layout serves a package. To build one with oel package, the name in metadata.oel has to be a package name, such as acme/billing: lower case and slash-separated. The package's main then takes the last segment of that name, as in main billing(). Building a package describes the rules.
Next
- Checking source: check the new project.
- A first program: a walk-through from
oel initto a running program. - Files and roles: the file names and roles of a project.