diff options
Diffstat (limited to 'src/project.rs')
-rw-r--r-- | src/project.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/project.rs b/src/project.rs index 7471c66..9f45363 100644 --- a/src/project.rs +++ b/src/project.rs @@ -1,25 +1,37 @@ +use crate::debian::Debian; use crate::errors::BumperError; use crate::rust::Rust; use std::path::Path; pub enum ProjectKind { Rust(Rust), + Debian(Debian), } impl ProjectKind { - pub fn detect<P: AsRef<Path>>(dirname: P) -> Result<ProjectKind, BumperError> { + pub fn detect<P: AsRef<Path>>(dirname: P) -> Result<Vec<ProjectKind>, BumperError> { let dirname = dirname.as_ref(); + let mut kinds = vec![]; if let Ok(p) = Rust::new(dirname) { - return Ok(Self::Rust(p)); + kinds.push(ProjectKind::Rust(p)); } - Err(BumperError::UnknownProjectKind(dirname.to_path_buf())) + if let Ok(p) = Debian::new(dirname) { + kinds.push(ProjectKind::Debian(p)); + } + + if kinds.is_empty() { + Err(BumperError::UnknownProjectKind(dirname.to_path_buf())) + } else { + Ok(kinds) + } } pub fn set_version(&mut self, version: &str) -> Result<(), BumperError> { match self { Self::Rust(ref mut rust) => rust.set_version(version)?, + Self::Debian(ref mut debian) => debian.set_version(version)?, } Ok(()) } |