feat: Add template system to weevil new command
Implements template-based project creation allowing teams to start with
professional example code instead of empty projects.
Features:
- Two templates: 'basic' (minimal) and 'testing' (45-test showcase)
- Template variable substitution ({{PROJECT_NAME}}, etc.)
- Template validation with helpful error messages
- `weevil new --list-templates` command
- Template files embedded in binary at compile time
Technical details:
- Templates stored in templates/basic/ and templates/testing/
- Files ending in .template have variables replaced
- Uses include_dir! macro to embed templates in binary
- Returns file count for user feedback
Testing template includes:
- 3 complete subsystems (MotorCycler, WallApproach, TurnController)
- Hardware abstraction layer with mock implementations
- 45 comprehensive tests (unit, integration, system)
- Professional documentation (DESIGN_AND_TEST_PLAN.md, etc.)
Usage:
weevil new my-robot # basic template
weevil new my-robot --template testing # testing showcase
weevil new --list-templates # show available templates
This enables FTC teams to learn from working code and best practices
rather than starting from scratch.
This commit is contained in:
53
templates/basic/README.md.template
Normal file
53
templates/basic/README.md.template
Normal file
@@ -0,0 +1,53 @@
|
||||
# {{PROJECT_NAME}}
|
||||
|
||||
FTC Robot project created with Weevil {{WEEVIL_VERSION}} on {{CREATION_DATE}}.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This is a minimal FTC robot project. Add your robot code in:
|
||||
- `src/main/java/robot/opmodes/` - OpModes for TeleOp and Autonomous
|
||||
- `src/main/java/robot/subsystems/` - Robot subsystems
|
||||
- `src/main/java/robot/hardware/` - Hardware abstractions
|
||||
|
||||
## Building
|
||||
|
||||
```bash
|
||||
# Setup environment (first time only)
|
||||
weevil setup
|
||||
|
||||
# Build APK
|
||||
weevil build
|
||||
|
||||
# Deploy to robot
|
||||
weevil deploy
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
{{PROJECT_NAME}}/
|
||||
├── src/
|
||||
│ ├── main/java/robot/
|
||||
│ │ ├── hardware/ # Hardware interfaces
|
||||
│ │ ├── subsystems/ # Robot subsystems
|
||||
│ │ └── opmodes/ # TeleOp and Autonomous
|
||||
│ └── test/java/robot/ # Unit tests
|
||||
├── build.gradle # Build configuration
|
||||
└── README.md # This file
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Add your robot hardware in `src/main/java/robot/hardware/`
|
||||
2. Create subsystems in `src/main/java/robot/subsystems/`
|
||||
3. Write OpModes in `src/main/java/robot/opmodes/`
|
||||
4. Test and deploy!
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Weevil Documentation](https://docs.weevil.dev)
|
||||
- [FTC SDK Documentation](https://ftc-docs.firstinspires.org)
|
||||
|
||||
---
|
||||
|
||||
Created with [Weevil](https://weevil.dev) - FTC Project Generator
|
||||
Reference in New Issue
Block a user