pub trait PMOperationswhere
    Self: Sized,
{ type Dirs: Directories; type Store: ProjectStore<Self::Project>; type Project: ProjectIface; type Error: Error + From<Error> + From<CommonPMErrors> + From<Error>;
Show 14 methods fn new() -> Result<Self, Self::Error>; fn map_store_error(
        err: <Self::Store as ProjectStore<Self::Project>>::Error
    ) -> Self::Error; fn map_dir_error(err: <Self::Dirs as Directories>::Error) -> Self::Error; fn get_store(&self) -> &Self::Store; fn get_mut_store(&mut self) -> &mut Self::Store; fn get_dirs(&self) -> &Self::Dirs; fn copy_directory<T: AsRef<Path>, Q: AsRef<Path>>(
        &self,
        from: T,
        to: Q
    ) -> Result<(), Self::Error>; fn script_runner<T: AsRef<str>, Q: AsRef<[T]>>(
        &self,
        dir: &str,
        script: Q
    ) -> Result<(), Self::Error>; fn download(
        &self,
        prj: &Self::Project
    ) -> Result<(Repository, PathBuf), Self::Error> { ... } fn switch_branch(
        &self,
        prj: &Self::Project,
        repo: &Repository
    ) -> Result<(), Self::Error> { ... } fn mv(&self, prj: &Self::Project, path: &Path) -> Result<(), Self::Error> { ... } fn build(&self, prj: &Self::Project) -> Result<(), Self::Error> { ... } fn unbuild(&self, prj: &Self::Project) -> Result<(), Self::Error> { ... } fn update_repo(
        &self,
        prj: &Self::Project,
        repo: &Repository
    ) -> Result<(), Self::Error> { ... }
}
Expand description

A trait that concerns itself with the “low level” operations of the project manager, with how things are done.

Required Associated Types§

A type that implements the PMDirs trait

A type that implements the ProjectStore trait for projects of type Self::Project

A type that implements the ProjectT trait

A type that can hold all the errors originated from the different functions. It’s the same for the PMOperations and PMInteractive

Required Methods§

Create a project manager struct, type or whatever

Map the errors created by your store to project manager errors Typically

Self::Error::Store(err)

Map the errors produced by your PMDirs implementer to project manager errors Typically

Self::Error::Dirs(err)

Provide a reference to whatever store you are using. If you are using a structure to implement the project manager and you want your project manager to hold within itself a store then its a easy as

&self.store

Provide a mutable reference to the same store

Provide a reference to whatever mechanism you are using to implement Directories

Copy a directory completely from one place to another. With the fs_extra crate this function is as easy as

 let opts = CopyOptions {
     overwrite: true,
     copy_inside: true,
     ..Default::default()
 };
 dir::copy(from, to, &opts)?;
 Ok(())

Run a script to install or uninstall a project

Provided Methods§

Clone a project from the projects url

Errors
  • Failure cloning the repo.

Change to the branch designated by the project’s reference

Errors
  • Finding the object prj.get_ref_string() in the repo
  • Checking out the tree with that object
  • If there is no reference to set the head to -> CommonPMErrors::BadRef
  • Setting the head to the head of the reference

Move from wherever to the projects subdirectory in the sources directory

Errors
  • Deleting the directories (in established in Dirs::new().unwrap().src or path)
  • Copying the directories

Run the build script from the src() directory.

Errors
  • Script runner failure

Run the uninstall script from the src() directory

Errors
  • Script runner failure

Update a repo, getting the latest changes if they can be fast forwarded to, and ensuring that the correct reference is updated

Errors
  • Getting the remotes
  • Fetching the remotes
  • Finding the reference "FETCH_HEAD"
  • Getting the commit to said reference
  • Analyzing the merge
  • If there is no possibility of solving with Fast Forward, then -> CommonPMErrors::ImposibleUpdate
  • Resolving the merge with Fast-Forward strategy
  • Seting the head to the new head

Implementors§