pub struct Generator {
pub executer: Arc<dyn Executer>,
pub settings: Settings,
}Expand description
The Generator struct provides functionality to execute scripted
operations, such as copying files and templates, based on the current
settings.
Fields§
§executer: Arc<dyn Executer>§settings: SettingsImplementations§
Source§impl Generator
impl Generator
Sourcepub fn new(executer: Arc<dyn Executer>, settings: Settings) -> Self
pub fn new(executer: Arc<dyn Executer>, settings: Settings) -> Self
Creates a new Generator with a given executor and settings.
Sourcepub fn run_from_script(&self, script: &str) -> Result<()>
pub fn run_from_script(&self, script: &str) -> Result<()>
Sourcepub fn copy_file(&mut self, path: &str) -> Result<(), Box<EvalAltResult>>
pub fn copy_file(&mut self, path: &str) -> Result<(), Box<EvalAltResult>>
Copies a single file from the specified path.
§Errors
Returns an error if the file copy operation fails.
Sourcepub fn create_file(
&mut self,
path: &str,
content: &str,
) -> Result<(), Box<EvalAltResult>>
pub fn create_file( &mut self, path: &str, content: &str, ) -> Result<(), Box<EvalAltResult>>
Creates a single file in the specified path.
§Errors
Returns an error if the file copy operation fails.
Sourcepub fn copy_files(&mut self, paths: Array) -> Result<(), Box<EvalAltResult>>
pub fn copy_files(&mut self, paths: Array) -> Result<(), Box<EvalAltResult>>
Copies list of files from the specified path.
§Errors
Returns an error if the file copy operation fails.
Sourcepub fn copy_dir(&mut self, path: &str) -> Result<(), Box<EvalAltResult>>
pub fn copy_dir(&mut self, path: &str) -> Result<(), Box<EvalAltResult>>
Copies an entire directory from the specified path.
§Errors
Returns an error if the directory copy operation fails.
Sourcepub fn copy_dirs(&mut self, paths: Array) -> Result<(), Box<EvalAltResult>>
pub fn copy_dirs(&mut self, paths: Array) -> Result<(), Box<EvalAltResult>>
Copies list of directories from the specified path.
§Errors
Returns an error if the directory copy operation fails.
Sourcepub fn copy_template(&mut self, path: &str) -> Result<(), Box<EvalAltResult>>
pub fn copy_template(&mut self, path: &str) -> Result<(), Box<EvalAltResult>>
Copies a template file from the specified path, applying settings.
§Errors
Returns an error if the template copy operation fails.
Sourcepub fn copy_template_dir(
&mut self,
path: &str,
) -> Result<(), Box<EvalAltResult>>
pub fn copy_template_dir( &mut self, path: &str, ) -> Result<(), Box<EvalAltResult>>
Copies an entire template directory from the specified path, applying settings.
§Errors
Returns an error if the template directory copy operation fails.