pub struct BoilerplateManager;Expand description
Manages boilerplate operations: loading, validation, and application
Implements requirements:
- Requirement 3.1: Load and parse boilerplate definitions
- Requirement 3.2: Validate boilerplate before application
- Requirement 3.3: Prompt for variable customization
- Requirement 3.4: Handle file conflicts (skip/overwrite/merge)
- Requirement 3.5: Support custom boilerplate creation
- Requirement 3.6: Validate boilerplate structure
Implementations§
Source§impl BoilerplateManager
impl BoilerplateManager
Sourcepub fn load(
&self,
boilerplate_path: &Path,
) -> Result<Boilerplate, BoilerplateError>
pub fn load( &self, boilerplate_path: &Path, ) -> Result<Boilerplate, BoilerplateError>
Load a boilerplate from a directory
Parses the boilerplate metadata and validates the structure.
§Arguments
boilerplate_path- Path to the boilerplate directory
§Returns
Loaded boilerplate or error
§Requirements
- Requirement 3.1: Load and parse boilerplate definitions
- Requirement 3.2: Validate boilerplate before application
Sourcepub fn load_by_name(
&self,
project_root: &Path,
boilerplate_name: &str,
) -> Result<Boilerplate, BoilerplateError>
pub fn load_by_name( &self, project_root: &Path, boilerplate_name: &str, ) -> Result<Boilerplate, BoilerplateError>
Sourcepub fn validate(
&self,
boilerplate: &Boilerplate,
) -> Result<(), BoilerplateError>
pub fn validate( &self, boilerplate: &Boilerplate, ) -> Result<(), BoilerplateError>
Sourcepub fn extract_placeholders(
&self,
boilerplate: &Boilerplate,
) -> Result<HashMap<String, String>, BoilerplateError>
pub fn extract_placeholders( &self, boilerplate: &Boilerplate, ) -> Result<HashMap<String, String>, BoilerplateError>
Sourcepub fn apply(
&self,
boilerplate: &Boilerplate,
target_dir: &Path,
variables: &HashMap<String, String>,
conflict_resolution: ConflictResolution,
) -> Result<ScaffoldingResult, BoilerplateError>
pub fn apply( &self, boilerplate: &Boilerplate, target_dir: &Path, variables: &HashMap<String, String>, conflict_resolution: ConflictResolution, ) -> Result<ScaffoldingResult, BoilerplateError>
Apply a boilerplate to create a new project
Creates the project structure from the boilerplate, rendering templates with provided values.
§Arguments
boilerplate- Boilerplate to applytarget_dir- Directory where to create the projectvariables- Variable values for template substitutionconflict_resolution- How to handle file conflicts
§Returns
Result of scaffolding operation
§Requirements
- Requirement 3.1: Create project structure from boilerplate
- Requirement 3.3: Render template files with context
- Requirement 3.4: Handle file conflicts (skip/overwrite/merge)
Sourcepub fn create_custom(
&self,
source_dir: &Path,
boilerplate_id: &str,
boilerplate_name: &str,
language: &str,
) -> Result<Boilerplate, BoilerplateError>
pub fn create_custom( &self, source_dir: &Path, boilerplate_id: &str, boilerplate_name: &str, language: &str, ) -> Result<Boilerplate, BoilerplateError>
Create a custom boilerplate from a template
Generates a new boilerplate definition from a template directory.
§Arguments
source_dir- Directory containing the template filesboilerplate_id- ID for the new boilerplateboilerplate_name- Name for the new boilerplatelanguage- Programming language
§Returns
Created boilerplate or error
§Requirements
- Requirement 3.5: Support custom boilerplate creation
Sourcepub fn save(
&self,
boilerplate: &Boilerplate,
target_dir: &Path,
) -> Result<(), BoilerplateError>
pub fn save( &self, boilerplate: &Boilerplate, target_dir: &Path, ) -> Result<(), BoilerplateError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BoilerplateManager
impl RefUnwindSafe for BoilerplateManager
impl Send for BoilerplateManager
impl Sync for BoilerplateManager
impl Unpin for BoilerplateManager
impl UnwindSafe for BoilerplateManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more