chore(release): 0.1.0 (#6)
### Added - add docker setup - refactor frontend configuration - with all the way through - with create pull request and release - with gitea - with prepend as well - add cliff - remove tokio - with doctor - with git client - with fixes - with conventional parse - with tags command - add semver - can get commit chain - with start of environment engine - with gitea client - fmt - add gitea client stub - add tests for git setup - split headings into local and global - rename to cuddle_please - add config parsing - with basic get dir - add mkdocs - add base ### Other - remove old changelog - *(deps)* update all dependencies (#2) - *(release)* 0.0.1 (#4) - release command - add cuddle.release to this repository - add granular docker setup - fix checks - chck refactor commands - move doctor command - fmt - rename release command - move gitea command into its own file - move config list - move gitea out of the way - move config building out of main execution loop - move commands and misc out of main binary package - fmt - check hide commands - move cuddle-please to cuddle-please release - remove no-vcs option (moved to a later stage if github is someday adopted - fix clippy warnings - clippy fix - fix - cleanup Reviewed-on: #6 Co-authored-by: kjuulh <contact@kjuulh.io> Co-committed-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -3,7 +3,11 @@ use std::path::{Path, PathBuf};
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum VcsClient {
|
||||
Noop {},
|
||||
Git { source: PathBuf },
|
||||
Git {
|
||||
source: PathBuf,
|
||||
username: String,
|
||||
email: String,
|
||||
},
|
||||
}
|
||||
|
||||
impl VcsClient {
|
||||
@@ -11,13 +15,23 @@ impl VcsClient {
|
||||
Self::Noop {}
|
||||
}
|
||||
|
||||
pub fn new_git(path: &Path) -> anyhow::Result<VcsClient> {
|
||||
pub fn new_git(
|
||||
path: &Path,
|
||||
git_username: Option<impl Into<String>>,
|
||||
git_email: Option<impl Into<String>>,
|
||||
) -> anyhow::Result<VcsClient> {
|
||||
if !path.to_path_buf().join(".git").exists() {
|
||||
anyhow::bail!("git directory not found in: {}", path.display().to_string())
|
||||
}
|
||||
|
||||
Ok(Self::Git {
|
||||
source: path.to_path_buf(),
|
||||
username: git_username
|
||||
.map(|u| u.into())
|
||||
.unwrap_or("cuddle-please".to_string()),
|
||||
email: git_email
|
||||
.map(|e| e.into())
|
||||
.unwrap_or("bot@cuddle.sh".to_string()),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -38,9 +52,19 @@ impl VcsClient {
|
||||
fn exec_git(&self, args: &[&str]) -> anyhow::Result<()> {
|
||||
match self {
|
||||
VcsClient::Noop {} => {}
|
||||
VcsClient::Git { source } => {
|
||||
VcsClient::Git {
|
||||
source,
|
||||
username,
|
||||
email,
|
||||
} => {
|
||||
let checkout_branch = std::process::Command::new("git")
|
||||
.current_dir(source.as_path())
|
||||
.args(&[
|
||||
"-c",
|
||||
&format!("user.name={}", username),
|
||||
"-c",
|
||||
&format!("user.email={}", email),
|
||||
])
|
||||
.args(args)
|
||||
.output()?;
|
||||
|
||||
|
Reference in New Issue
Block a user