summaryrefslogtreecommitdiff
path: root/src/project.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/project.rs')
-rw-r--r--src/project.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/project.rs b/src/project.rs
index e67fefc..655fb23 100644
--- a/src/project.rs
+++ b/src/project.rs
@@ -2,6 +2,7 @@ use crate::debian::Debian;
use crate::errors::BumperError;
use crate::python::Python;
use crate::rust::Rust;
+use log::{debug, info};
use std::path::Path;
pub enum ProjectKind {
@@ -15,6 +16,8 @@ impl ProjectKind {
let dirname = dirname.as_ref();
let mut kinds = vec![];
+ debug!("detecting kinds of project in {}", dirname.display());
+
if let Ok(p) = Rust::new(dirname) {
kinds.push(ProjectKind::Rust(p));
}
@@ -30,16 +33,26 @@ impl ProjectKind {
if kinds.is_empty() {
Err(BumperError::UnknownProjectKind(dirname.to_path_buf()))
} else {
+ for kind in kinds.iter() {
+ info!("{} project in {}", kind.desc(), dirname.display());
+ }
Ok(kinds)
}
}
- pub fn set_version(&mut self, version: &str) -> Result<(), BumperError> {
+ pub fn desc(&self) -> &'static str {
match self {
+ Self::Debian(_) => "Debian package",
+ Self::Python(_) => "Python",
+ Self::Rust(_) => "Rust",
+ }
+ }
+
+ pub fn set_version(&mut self, version: &str) -> Result<String, BumperError> {
+ Ok(match self {
Self::Rust(ref mut rust) => rust.set_version(version)?,
Self::Debian(ref mut debian) => debian.set_version(version)?,
Self::Python(ref mut python) => python.set_version(version)?,
- }
- Ok(())
+ })
}
}