diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-04 12:30:52 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-04 14:57:38 +0300 |
commit | d60b3fbf8d1840e5a1b5b088333e136616068c15 (patch) | |
tree | 6f48e856c00748f36f518c9032ddbcdd1fa7a86a /src/project.rs | |
parent | cbeff8974a6228a44396cc924acc6fd111a5b681 (diff) | |
download | bumper-rs-d60b3fbf8d1840e5a1b5b088333e136616068c15.tar.gz |
feat: set version in debian/changelog
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(()) } |