Trait amisgitpm::pm::PMProgrammatic
source · pub trait PMProgrammatic: PMOperations {
fn install(&mut self, prj: Self::Project) -> Result<(), Self::Error> { ... }
fn uninstall<T: AsRef<str>>(
&mut self,
prj_name: T
) -> Result<(), Self::Error> { ... }
fn update<T: AsRef<str>>(&self, prj_name: T) -> Result<(), Self::Error> { ... }
fn restore<T: AsRef<str>>(&self, prj_name: T) -> Result<(), Self::Error> { ... }
fn edit<T: AsRef<str>>(
&mut self,
prj_name: T,
prj: Self::Project
) -> Result<(), Self::Error> { ... }
fn get_one<T: AsRef<str>>(&self, prj_name: T) -> Option<&Self::Project> { ... }
fn get_all(&self) -> Vec<&Self::Project> { ... }
}
Expand description
A trait that implement the six tasks based on the PMOperations
trait.
It is designed for programtic use of the project
Provided Methods§
sourcefn install(&mut self, prj: Self::Project) -> Result<(), Self::Error>
fn install(&mut self, prj: Self::Project) -> Result<(), Self::Error>
Install a project from a known Project in which all parameters are known
Errors
- If there is a project with that name or directory already in use ->
CommonPMErrors::AlreadyExisting
- Switching branches
- Moving dirs
- Adding to the store
- Building the project
sourcefn uninstall<T: AsRef<str>>(&mut self, prj_name: T) -> Result<(), Self::Error>
fn uninstall<T: AsRef<str>>(&mut self, prj_name: T) -> Result<(), Self::Error>
Uninstall a project given it’s name
Errors
- Unable to get the project ->
CommonPMErrors::NonExisting
- Unable to run the uninstall script
- Unable to delete directories -> Normally permissions errors.
- Unable to remove from store.
sourcefn update<T: AsRef<str>>(&self, prj_name: T) -> Result<(), Self::Error>
fn update<T: AsRef<str>>(&self, prj_name: T) -> Result<(), Self::Error>
Update a project given it’s name
Errors
- Unable to get the project ->
CommonPMErrors::NonExisting
- Unable to copy directories
- Unable to open the repo
- Unable to switch to the established branch
- Unable to update the repo
- Unable to move the project
- Unable to build the project
sourcefn restore<T: AsRef<str>>(&self, prj_name: T) -> Result<(), Self::Error>
fn restore<T: AsRef<str>>(&self, prj_name: T) -> Result<(), Self::Error>
Install the older version of a project given it’s name
Errors
- Unable to get the project ->
CommonPMErrors::NonExisting
- Unable to remove the src directory
- Unable to copy the directory from old to new
- Unable to build the project
sourcefn edit<T: AsRef<str>>(
&mut self,
prj_name: T,
prj: Self::Project
) -> Result<(), Self::Error>
fn edit<T: AsRef<str>>(
&mut self,
prj_name: T,
prj: Self::Project
) -> Result<(), Self::Error>
Substitute the contents of a project with name prj_name
with the contents in prj
Errors
- Store error getting the project or substituting it.