copyAll method
Copy all templates based on config with progress tracking
Implementation
Future<void> copyAll() async {
// Create output directory if needed
final Directory outputDir = Directory(config.outputDir);
if (!outputDir.existsSync()) {
await outputDir.create(recursive: true);
}
// Build list of templates to copy
final List<(String, Future<void> Function())> templates =
<(String, Future<void> Function())>[('Main app', copyAppTemplate)];
if (config.createModels) {
templates.add(('Models package', copyModelsTemplate));
}
if (config.createServer) {
templates.add(('Server app', copyServerTemplate));
}
templates.add(('References', copyReferences));
// Copy each template with progress
for (int i = 0; i < templates.length; i++) {
final (String name, Future<void> Function() copier) = templates[i];
UserPrompt.showProgress(i, templates.length, 'Copying $name...');
await copier();
}
UserPrompt.showProgress(
templates.length,
templates.length,
'All templates copied',
);
// Emit the project-level "Deploy All" IntelliJ run configuration.
//
// Lives at the project ROOT (not in any individual sub-package) so
// it's discoverable when the user opens the multi-package workspace
// in IntelliJ / Android Studio. Template-agnostic — every Oracular
// project benefits from a one-click `oracular deploy all` button.
//
// Non-fatal on failure: the project is still usable, the user just
// has to add the run config manually (or run `oracular update runs`).
await TemplateRunConfigWriter.generateProjectDeploy(
projectDir: config.outputDir,
);
}