Skip to main content

Module scaffold

Module scaffold 

Source
Expand description

Project + plugin scaffolding.

Two functions:

  • scaffold_project writes a complete new project directory. Maps to umbral startproject <name>.
  • scaffold_app writes a new plugin crate at plugins/<name>/. Maps to umbral startapp <name>.

Both are pure: take a target path and the new name, write files, return what was written. The binary’s main.rs wraps them with CLI parsing + a stdout report.

Structs§

ScaffoldReport
Report returned by both scaffolding functions: the paths written, so the binary can print them to the user.

Enums§

CommandTarget
Where a scaffolded management command lives: the project’s own binary (registered on the App builder via .commands(commands::all())) or a plugin under plugins/<name>/ (returned from its Plugin::commands(), so it travels with the plugin).
ScaffoldError
Error type for scaffolding operations. Wraps I/O and validation failures with enough context for a user-facing message.

Constants§

RESERVED_PLUGIN_COMMAND_NAMES
Commands shipped by a built-in plugin. Unlike the framework’s own subcommands, these can’t be read off a clap parser — they only exist once the plugin is registered on an App, and startcommand runs outside any App. So they’re listed.
RESERVED_PLUGIN_NAMES
Built-in plugin names that umbral startapp refuses to scaffold over. Adding a new built-in plugin? Add its name here so future startapp <name> calls fail fast with a clear message.

Functions§

discover_plugins
List the plugins available in this project: every plugins/<name>/ directory that holds a Cargo.toml.
register_dep_in_cargo_toml
Attempt to register <name> = { path = "plugins/<name>" } under [dependencies] in the project’s Cargo.toml.
reserved_command_names
Every command name a new command may not take: the framework’s own subcommands plus RESERVED_PLUGIN_COMMAND_NAMES.
scaffold_app
Deprecated alias for scaffold_plugin. Everything the framework generates under plugins/ is a plugin — there is no separate “app” contract — so the old minimal startapp writer folds into startplugin / scaffold_plugin, leaving one generator to maintain. Kept as a forwarding shim so existing API callers keep working; the CLI startapp command forwards here and prints a deprecation note. (Not #[deprecated] at the Rust level — that would warn on every internal test call site; the user-facing deprecation lives on the CLI command.)
scaffold_command
Write a management command and register it.
scaffold_plugin
Write a richer plugin scaffold at <project_root>/plugins/<name>/ targeted at distributable / reusable plugins (third-party crates you’d publish or share across projects). Layout:
scaffold_project