Trait BuildTool

Source
pub trait BuildTool: Debug + Display {
    // Required method
    fn clean_project(&mut self, dry_run: bool) -> Result<()>;

    // Provided methods
    fn status(&self) -> Result<BuildStatus> { ... }
    fn project_name(&self) -> Option<Result<String>> { ... }
}

Required Methods§

Source

fn clean_project(&mut self, dry_run: bool) -> Result<()>

Clean the project.

Depending on the build tool represented, this should preferably invoke the tool itself, calling its “clean” command. If that’s not possible, because the tool either doesn’t support it (e.g., NPM), or because the tool is not present/installed, the implementation may fall back to removing well-known directories itself (e.g., the node_modules directory for NPM).

If dry_run is true, no files are changed. Instead, a description on what would happen is printed to stdout.

Provided Methods§

Source

fn status(&self) -> Result<BuildStatus>

Source

fn project_name(&self) -> Option<Result<String>>

The project’s name as parsed from build tool configuration.

Returns None if the project has no name configured, or in case the build tool doesn’t implement this feature yet. As a fallback, the name of the parent directory will be considered as the project’s name.

Implementors§