← back to roto on ba3a.dev

ProjectScaffolder

Writes a new project from a ProjectPreset: roto/palette.hex, roto/ramps.json, then roto.json last, so a folder holding roto.json is always a complete project. Writes nothing and overwrites nothing: if any of the three files exists it stops first.

Functions

Link copied to clipboard
fun files(folder: Path, config: ProjectConfig): List<Path>

The files scaffold writes under folder for config, in the order it writes them.

Link copied to clipboard
fun scaffold(preset: ProjectPreset, config: ProjectConfig, folder: Path, writer: ScaffoldWriter = DirectWriter): Project

Writes preset's palette and ramps and config as a project under folder, like the overload that takes an id. config is the roto.json to write, so it may carry what a preset cannot: custom templates and an afterPublish command. It must keep PRESET_PALETTE_PATH and PRESET_RAMPS_PATH as its palette and ramps.

fun scaffold(preset: ProjectPreset, id: String, folder: Path, writer: ScaffoldWriter = DirectWriter): Project

Writes preset as project id under folder and returns it opened. id must follow SafeName. A failed write is a ScaffoldException listing the files already written; a failure to load the result propagates unchanged. Each write goes through writer.