Compare commits

...

21 Commits
v0.4.0 ... main

Author SHA1 Message Date
4134c4dd7c chore(deps): update rust crate serde to v1.0.218
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-21 01:32:47 +00:00
67a0f5d1fc chore(release): v0.6.0 (#39)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
chore(release): 0.6.0

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: #39
2025-01-10 00:29:53 +01:00
17878cace3
feat: ignore git found
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2025-01-10 00:28:08 +01:00
b059201aea
fix: multi line commit bodies should be prefixed with correct amount of spaces
All checks were successful
continuous-integration/drone/push Build is passing
this allows multi line commit messages to be displayed in a nice manner
2025-01-10 00:20:12 +01:00
e7fdc1813a
docs: add simple docs
All checks were successful
continuous-integration/drone/push Build is passing
2025-01-10 00:14:06 +01:00
5fd902f87c feat: enable commit bodies in changelog and fixes general warnings and updates (#49)
All checks were successful
continuous-integration/drone/push Build is passing
Allows commit bodies to show up in release notes, this is something I'd prefer as my releases are usually short, and I'd like to see these as I don't use pull requests as often, and often miss the context, as I don't link to commits currently.

Also fixes a lot of warnings and reintroduces failing tests, still not perfect, but better than before.
Co-authored-by: kjuulh <contact@kjuulh.io>
Co-committed-by: kjuulh <contact@kjuulh.io>
2025-01-09 23:46:07 +01:00
600d8c184c chore(deps): update rust crate serde to v1.0.217
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-28 01:28:59 +00:00
be27da1712 chore(deps): update rust crate serde to v1.0.216
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-11 05:24:41 +00:00
87e789d657 chore(deps): update rust crate tracing-subscriber to v0.3.19
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-30 01:43:37 +00:00
16710ed41b chore(deps): update rust crate tracing to v0.1.41
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-28 01:28:01 +00:00
18bd9e900a chore(deps): update rust crate serde to v1.0.215
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-12 01:22:22 +00:00
545e8c5476 chore(deps): update rust crate serde to v1.0.214
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-29 01:27:46 +00:00
42f23fdfac chore(deps): update rust crate serde to v1.0.213
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-23 00:28:22 +00:00
249a40f1aa chore(deps): update rust crate serde to v1.0.210
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-17 00:26:58 +00:00
c1187022f2
feat: removed tests for now
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-10-16 21:40:02 +02:00
0fc1438a4a
feat: update deps
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-10-16 21:30:38 +02:00
166be0c289
feat: update
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-10 15:48:57 +02:00
cuddle-please
ff9f5e25d2
chore(release): 0.5.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
chore: stuff

feat: something

Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-10 15:47:28 +02:00
9ac744b39d
feat: stuff
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-09 23:31:19 +02:00
9c967a0f31
feat: with rust version
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-09 23:10:12 +02:00
3878e6bc0a
feat: add rust actions
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-04-09 22:57:01 +02:00
26 changed files with 2149 additions and 609 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
target/
.cuddle/
.env
crates/cuddle-please/testdata/git-found/

View File

@ -6,6 +6,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.6.0] - 2025-01-09
### Added
- ignore git found
- enable commit bodies in changelog and fixes general warnings and updates (#49)
Allows commit bodies to show up in release notes, this is something I'd prefer as my releases are usually short, and I'd like to see these as I don't use pull requests as often, and often miss the context, as I don't link to commits currently.
Also fixes a lot of warnings and reintroduces failing tests, still not perfect, but better than before.
Co-authored-by: kjuulh <contact@kjuulh.io>
Co-committed-by: kjuulh <contact@kjuulh.io>
- removed tests for now
- update deps
- update
### Docs
- add simple docs
### Fixed
- multi line commit bodies should be prefixed with correct amount of spaces
this allows multi line commit messages to be displayed in a nice manner
### Other
- *(deps)* update rust crate serde to v1.0.217
- *(deps)* update rust crate serde to v1.0.216
- *(deps)* update rust crate tracing-subscriber to v0.3.19
- *(deps)* update rust crate tracing to v0.1.41
- *(deps)* update rust crate serde to v1.0.215
- *(deps)* update rust crate serde to v1.0.214
- *(deps)* update rust crate serde to v1.0.213
- *(deps)* update rust crate serde to v1.0.210
## [0.5.0] - 2024-04-09
### Added
- stuff
- with rust version
- add rust actions
## [0.4.0] - 2024-04-08
### Added
@ -103,7 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- add mkdocs build
- add basic version
- update with repository
- add publishable to rest
- add publish to rest
- hack get in control of log level
### Docs

2186
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,5 @@
[workspace]
members = [
"crates/cuddle-please",
"crates/cuddle-please-frontend",
"crates/cuddle-please-commands",
"crates/cuddle-please-misc",
"crates/cuddle-please-release-strategy"
]
members = ["crates/*"]
resolver = "2"
[workspace.dependencies]
@ -14,24 +8,30 @@ cuddle-please-frontend = { path = "crates/cuddle-please-frontend", version = "0.
cuddle-please-commands = { path = "crates/cuddle-please-commands", version = "0.1.0" }
cuddle-please-misc = { path = "crates/cuddle-please-misc", version = "0.1.0" }
cuddle-please-release-strategy = { path = "crates/cuddle-please-release-strategy", version = "0.1.0" }
cuddle-please-actions = { path = "crates/cuddle-please-actions", version = "0.1.0" }
anyhow = { version = "1.0.81" }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
clap = { version = "4.5.4", features = ["derive", "env"] }
dotenv = { version = "0.15.0" }
clap = { version = "4.5.23", features = ["derive", "env"] }
dotenvy = { version = "0.15.7" }
url = { version = "2.5.0" }
serde_yaml = { version = "0.9.34+deprecated" }
yaml-rust2 = { version = "0.8.0" }
serde = { version = "1", features = ["derive"] }
semver = "1.0.22"
conventional_commit_parser = "0.9.4"
tempdir = "0.3.7"
reqwest = { version = "0.12.3" }
git-cliff-core = "2.2.0"
git-cliff-core = "2.7.0"
regex = "1.10.4"
chrono = "0.4.37"
lazy_static = "1.4.0"
parse-changelog = "0.6.6"
toml_edit = "0.22.9"
tracing-test = "0.2"
pretty_assertions = "1.4"
[workspace.package]
version = "0.6.0"

View File

@ -40,12 +40,12 @@ See docs for more information about installation and some such
- [x] Fix: 0.0.0 -> **v**0.0.0
- [ ] Add release strategies
- [ ] Add reporter for PR and Repositories
- [x] Add reporter for PR and Repositories
- [ ] Add inquire for missing values when needed (when not running in ci or have a proper tty)
- [ ] Break down cuddle-please-misc
- [x] Break down cuddle-please-misc
- [ ] ci(release): Add cuddle-please release artifacts for the different os and so on.
### 0.x Milestone
- [ ] Add github support
- [ ] Add custom strategies
- [ ] Add more granular tests
- [x] Add more granular tests

View File

@ -0,0 +1,19 @@
[package]
name = "cuddle-please-actions"
description = "A release-please inspired release manager tool, built on top of cuddle, but also useful standalone, cuddle-please supports, your ci of choice, as well as gitea, github"
repository = "https://git.front.kjuulh.io/kjuulh/cuddle-please"
readme = "../../README.md"
license-file = "../../LICENSE"
version = "0.1.0"
edition = "2021"
publish = true
[dependencies]
anyhow.workspace = true
tracing.workspace = true
semver.workspace = true
toml_edit.workspace = true
yaml-rust2.workspace = true
[dev-dependencies]
pretty_assertions.workspace = true

View File

@ -0,0 +1,9 @@
use semver::Version;
use crate::ActionConfig;
pub trait Action {
fn enabled(&self, config: &ActionConfig) -> anyhow::Result<bool>;
fn name(&self) -> String;
fn execute(&self, version: &Version) -> anyhow::Result<()>;
}

View File

@ -0,0 +1,49 @@
use std::ops::Deref;
use anyhow::Context;
pub enum ActionConfig {
Actual { doc: yaml_rust2::Yaml },
None,
}
impl Deref for ActionConfig {
type Target = yaml_rust2::Yaml;
fn deref(&self) -> &Self::Target {
match &self {
ActionConfig::Actual { doc } => doc,
ActionConfig::None => &yaml_rust2::Yaml::BadValue,
}
}
}
impl TryFrom<&str> for ActionConfig {
type Error = anyhow::Error;
fn try_from(value: &str) -> Result<Self, Self::Error> {
let mut cuddle = yaml_rust2::YamlLoader::load_from_str(value)?;
if cuddle.len() != 1 {
anyhow::bail!("cuddle.yaml can only be 1 document wide");
}
let doc = cuddle.pop().unwrap();
let doc = doc["please"]["actions"].clone();
if doc.is_badvalue() {
return Ok(Self::None);
}
Ok(Self::Actual { doc })
}
}
impl ActionConfig {
pub fn parse() -> anyhow::Result<Self> {
let cuddle_yaml =
std::fs::read_to_string("cuddle.yaml").context("failed to read cuddle.yaml")?;
Self::try_from(cuddle_yaml.as_str())
}
}

View File

@ -0,0 +1,45 @@
pub(crate) mod actions;
mod config;
mod rust_action;
use std::{ops::Deref, sync::Arc};
use catalog::RustAction;
pub use config::ActionConfig;
use semver::Version;
pub mod catalog {
pub use crate::rust_action::*;
}
pub struct Action(Arc<dyn actions::Action>);
impl Deref for Action {
type Target = Arc<dyn actions::Action>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
pub struct Actions(Vec<Action>);
impl Actions {
pub fn from_cuddle() -> anyhow::Result<Self> {
let config = ActionConfig::parse()?;
Ok(Self(
vec![Action(Arc::new(RustAction::new()))]
.into_iter()
.filter(|a| a.enabled(&config).unwrap_or_default())
.collect(),
))
}
pub fn execute(&self, version: &Version) -> anyhow::Result<()> {
for action in &self.0 {
action.execute(version)?;
}
Ok(())
}
}

View File

@ -0,0 +1,235 @@
use std::io::Write;
use crate::{actions::Action, ActionConfig};
#[derive(Default, Clone)]
pub struct RustAction {}
impl RustAction {
pub fn new() -> Self {
Self {}
}
fn execute_content(
&self,
version: &semver::Version,
cargo_content: &str,
) -> anyhow::Result<String> {
tracing::trace!("parsing Cargo.toml file as tolm");
let mut cargo_doc = cargo_content.parse::<toml_edit::DocumentMut>()?;
tracing::debug!(
"updating cargo workspace package version to {}",
version.to_string()
);
let workspace = if cargo_doc.contains_table("workspace") {
cargo_doc["workspace"].as_table_mut().unwrap()
} else {
let mut t = toml_edit::Table::new();
t.set_implicit(true);
cargo_doc["workspace"] = toml_edit::Item::Table(t);
cargo_doc["workspace"].as_table_mut().unwrap()
};
let package = workspace["package"].or_insert(toml_edit::table());
package["version"] = toml_edit::value(version.to_string());
Ok(cargo_doc.to_string())
}
}
impl Action for RustAction {
fn enabled(&self, config: &ActionConfig) -> anyhow::Result<bool> {
if let Ok(v) = std::env::var("CUDDLE_PLEASE_RUST_ACTION") {
if let Ok(true) = v.parse::<bool>() {
return Ok(true);
}
}
let val = &config[self.name().as_str()];
if val.is_badvalue() {
return Ok(false);
}
Ok(val.as_bool().unwrap_or(true))
}
fn name(&self) -> String {
"rust".into()
}
fn execute(&self, version: &semver::Version) -> anyhow::Result<()> {
tracing::info!(
"running rust action for version: {} and file: Cargo.toml",
version.to_string()
);
let path = std::path::PathBuf::from("Cargo.toml");
tracing::trace!("reading Cargo.toml");
let file = match std::fs::read_to_string(&path) {
Ok(file) => file,
Err(e) => match e.kind() {
std::io::ErrorKind::NotFound => {
anyhow::bail!("err: Cargo.toml was not found in dir")
}
_ => Err(e)?,
},
};
let cargo_doc = self.execute_content(version, &file)?;
let mut cargo_file = std::fs::File::create(&path)?;
cargo_file.write_all(cargo_doc.as_bytes())?;
cargo_file.sync_all()?;
tracing::debug!("finished writing cargo file");
Ok(())
}
}
#[cfg(test)]
mod test {
use semver::{BuildMetadata, Prerelease};
use crate::{actions::Action, ActionConfig};
use super::RustAction;
#[test]
fn test_is_enabled() {
let config = ActionConfig::try_from(
r#"
please:
actions:
rust: true
"#,
)
.unwrap();
let enabled = RustAction::new().enabled(&config).unwrap();
assert!(enabled)
}
#[test]
fn test_is_disabled_by_default() {
let config = ActionConfig::try_from(
r#"
please:
"#,
)
.unwrap();
let enabled = RustAction::new().enabled(&config).unwrap();
assert!(!enabled)
}
#[test]
fn test_is_disabled() {
let config = ActionConfig::try_from(
r#"
please:
actions:
rust: false
"#,
)
.unwrap();
let enabled = RustAction::new().enabled(&config).unwrap();
assert!(!enabled)
}
#[test]
fn test_missing_value_is_enabled() {
let config = ActionConfig::try_from(
r#"
please:
actions:
rust:
"#,
)
.unwrap();
let enabled = RustAction::new().enabled(&config).unwrap();
assert!(enabled)
}
#[test]
fn test_can_edit_empty_file() {
let output = RustAction::default()
.execute_content(
&semver::Version {
major: 0,
minor: 1,
patch: 0,
pre: Prerelease::default(),
build: BuildMetadata::default(),
},
"",
)
.unwrap();
pretty_assertions::assert_eq!(
r#"[workspace.package]
version = "0.1.0"
"#,
&output,
)
}
#[test]
fn test_only_edits_stuff() {
let input = r#"
[workspace]
members = ["."]
[package]
something = {some = "something"}
# Some comment
[workspace.package]
version = "0.0.0" # some comment
readme = "../../"
"#;
let output = RustAction::default()
.execute_content(
&semver::Version {
major: 0,
minor: 1,
patch: 0,
pre: Prerelease::default(),
build: BuildMetadata::default(),
},
input,
)
.unwrap();
pretty_assertions::assert_eq!(
r#"
[workspace]
members = ["."]
[package]
something = {some = "something"}
# Some comment
[workspace.package]
version = "0.1.0"
readme = "../../"
"#,
&output,
)
}
}

View File

@ -6,18 +6,19 @@ readme = "../../README.md"
license-file = "../../LICENSE"
version = "0.1.0"
edition = "2021"
publishable = true
publish = true
[dependencies]
cuddle-please-frontend.workspace = true
cuddle-please-misc.workspace = true
cuddle-please-actions.workspace = true
anyhow.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
dotenv.workspace = true
dotenvy.workspace = true
serde_yaml.workspace = true
serde.workspace = true
reqwest = { workspace = true, features = ["blocking", "json"] }

View File

@ -6,6 +6,7 @@ use std::{
};
use clap::{Parser, Subcommand};
use cuddle_please_actions::Actions;
use cuddle_please_frontend::{gatheres::ConfigArgs, PleaseConfig, PleaseConfigBuilder};
use cuddle_please_misc::{
ConsoleUi, DynRemoteGitClient, DynUi, GiteaClient, GlobalArgs, LocalGitClient, StdinFn,
@ -90,26 +91,27 @@ impl Command {
}
pub fn execute(self, current_dir: Option<&Path>) -> anyhow::Result<()> {
match &self.commands {
Some(Commands::Release {}) => {
let (config, git_client, gitea_client) = self.get_deps(current_dir)?;
ReleaseCommandHandler::new(self.ui, config, git_client, gitea_client)
if let Some(c) = &self.commands {
match c {
Commands::Release {} => {
let (config, git_client, gitea_client, actions) = self.get_deps(current_dir)?;
ReleaseCommandHandler::new(self.ui, config, git_client, gitea_client, actions)
.execute(self.global.dry_run)?;
}
Some(Commands::Config { command }) => {
let (config, _, _) = self.get_deps(current_dir)?;
Commands::Config { command } => {
let (config, _, _, _) = self.get_deps(current_dir)?;
ConfigCommandHandler::new(self.ui, config).execute(command)?;
}
Some(Commands::Gitea { command }) => {
let (config, _, gitea_client) = self.get_deps(current_dir)?;
Commands::Gitea { command } => {
let (config, _, gitea_client, _) = self.get_deps(current_dir)?;
GiteaCommandHandler::new(self.ui, config, gitea_client)
.execute(command, self.global.token.expect("token to be set").deref())?;
}
Some(Commands::Doctor {}) => {
Commands::Doctor {} => {
DoctorCommandHandler::new(self.ui).execute()?;
}
None => {}
}
}
Ok(())
@ -118,7 +120,7 @@ impl Command {
fn get_deps(
&self,
current_dir: Option<&Path>,
) -> anyhow::Result<(PleaseConfig, VcsClient, DynRemoteGitClient)> {
) -> anyhow::Result<(PleaseConfig, VcsClient, DynRemoteGitClient, Actions)> {
let config = self.build_config(current_dir)?;
let git_client =
self.get_git(&config, self.global.token.clone().expect("token to be set"))?;
@ -140,7 +142,9 @@ impl Command {
tracing_subscriber::fmt().with_env_filter(env_filter).init();
}
Ok((config, git_client, gitea_client))
let actions = self.get_actions()?;
Ok((config, git_client, gitea_client, actions))
}
fn build_config(&self, current_dir: Option<&Path>) -> Result<PleaseConfig, anyhow::Error> {
@ -183,6 +187,10 @@ impl Command {
)),
}
}
fn get_actions(&self) -> anyhow::Result<Actions> {
Actions::from_cuddle()
}
}
#[derive(Debug, Clone, Subcommand)]

View File

@ -1,3 +1,6 @@
use std::path::Path;
use cuddle_please_actions::Actions;
use cuddle_please_frontend::PleaseConfig;
use ::semver::Version;
@ -13,6 +16,7 @@ pub struct ReleaseCommandHandler {
config: PleaseConfig,
git_client: VcsClient,
gitea_client: DynRemoteGitClient,
actions: Actions,
}
impl ReleaseCommandHandler {
@ -21,12 +25,14 @@ impl ReleaseCommandHandler {
config: PleaseConfig,
git_client: VcsClient,
gitea_client: DynRemoteGitClient,
actions: Actions,
) -> Self {
Self {
ui,
config,
git_client,
gitea_client,
actions,
}
}
@ -69,6 +75,8 @@ impl ReleaseCommandHandler {
let (changelog_placement, changelog, changelog_last_changes) =
compose_changelog(&commit_strs, &next_version, source)?;
self.actions.execute(&next_version)?;
if let Some(first_commit) = commit_strs.first() {
if first_commit.contains("chore(release): ") {
tracing::trace!("creating release");
@ -122,6 +130,7 @@ impl ReleaseCommandHandler {
Ok(())
}
#[allow(clippy::too_many_arguments)]
fn create_pull_request(
&self,
changelog_placement: std::path::PathBuf,
@ -219,7 +228,7 @@ impl ReleaseCommandHandler {
fn compose_changelog(
commit_strs: &Vec<String>,
next_version: &Version,
source: &std::path::PathBuf,
source: &Path,
) -> Result<(std::path::PathBuf, String, Option<String>), anyhow::Error> {
let builder = ChangeLogBuilder::new(commit_strs, next_version.to_string()).build();
let changelog_placement = source.join("CHANGELOG.md");

View File

@ -6,14 +6,14 @@ readme = "../../README.md"
license-file = "../../LICENSE"
version = "0.1.0"
edition = "2021"
publishable = true
publish = true
[dependencies]
anyhow.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
dotenv.workspace = true
dotenvy.workspace = true
serde_yaml.workspace = true
serde.workspace = true
chrono.workspace = true

View File

@ -28,14 +28,8 @@ pub struct PleaseConfigBuilder {
impl PleaseConfigBuilder {
pub fn merge(&mut self, config: &PleaseConfigBuilder) -> &Self {
let config = config.clone();
let mut fproject = match self.project.clone() {
None => PleaseProjectConfigBuilder::default(),
Some(project) => project,
};
let mut fsettings = match self.settings.clone() {
None => PleaseSettingsConfigBuilder::default(),
Some(settings) => settings,
};
let mut fproject = self.project.clone().unwrap_or_default();
let mut fsettings = self.settings.clone().unwrap_or_default();
if let Some(project) = config.project {
if let Some(owner) = project.owner {

View File

@ -6,7 +6,7 @@ readme = "../../README.md"
license-file = "../../LICENSE"
version = "0.1.0"
edition = "2021"
publishable = true
publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -15,7 +15,7 @@ anyhow.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
dotenv.workspace = true
dotenvy.workspace = true
serde_yaml.workspace = true
serde.workspace = true
reqwest = { workspace = true, features = ["blocking", "json"] }
@ -29,6 +29,9 @@ chrono.workspace = true
lazy_static.workspace = true
parse-changelog.workspace = true
# Cliff depends on 13.1.0, which is a broken release
cacache = "=13.0.0"
[dev-dependencies]
tracing-test = { workspace = true, features = ["no-env-filter"] }
pretty_assertions.workspace = true

View File

@ -3,7 +3,7 @@ use chrono::{DateTime, NaiveDate, Utc};
use git_cliff_core::{
changelog::Changelog,
commit::Commit,
config::{Bump, ChangelogConfig, CommitParser, Config, GitConfig, Remote, RemoteConfig},
config::{Bump, ChangelogConfig, CommitParser, Config, GitConfig, RemoteConfig},
release::Release,
};
use regex::Regex;
@ -77,6 +77,9 @@ impl ChangeLogBuilder {
commit_id: None,
timestamp,
previous: None,
message: None,
repository: None,
extra: None,
},
config: self.config,
release_link: self.release_link,
@ -180,6 +183,7 @@ fn default_commit_parsers() -> Vec<CommitParser> {
field: None,
pattern: None,
sha: None,
footer: None,
}
}
@ -201,6 +205,7 @@ fn default_commit_parsers() -> Vec<CommitParser> {
field: None,
pattern: None,
sha: None,
footer: None,
},
]
}
@ -221,6 +226,8 @@ fn default_changelog_config(header: Option<String>, release_link: Option<&str>)
footer: None,
trim: Some(true),
postprocessors: None,
render_always: None,
output: None,
}
}
@ -236,6 +243,13 @@ fn default_changelog_body_config(release_link: Option<&str>) -> String {
{% else -%}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}
{% endif -%}
{%- if commit.body -%}
{%- if commit.body | length > 0 -%}
{% for line in commit.body | trim | split(pat="\n") -%}
{% raw %} {% endraw %}{{ line | trim }}
{% endfor -%}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endfor %}"#;
@ -508,7 +522,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#[test]
fn generates_changelog() {
let commits: Vec<&str> = vec![
"feat: some feature",
"feat: some feature
some body
and another line",
"some random commit",
"fix: some fix",
"chore(scope): some chore",
@ -529,6 +546,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- some feature
some body
and another line
### Fixed
- some fix

View File

@ -602,7 +602,7 @@ mod test {
let (expected, actual) = get_commits("second-sha".into()).unwrap();
assert_eq!(
expected.get(0).unwrap().clone().as_slice(),
expected.first().unwrap().clone().as_slice(),
actual.as_slice()
);
}

View File

@ -1,5 +1,6 @@
use crate::RemoteGitEngine;
#[derive(Default)]
pub struct LocalGitClient {}
impl LocalGitClient {

View File

@ -6,7 +6,7 @@ version = "0.1.0"
edition = "2021"
readme = "../../README.md"
license-file = "../../LICENSE"
publishable = true
publish = true
[dependencies]
anyhow.workspace = true

View File

@ -2,11 +2,13 @@ use std::path::PathBuf;
use serde::{Deserialize, Serialize};
#[allow(dead_code)]
pub struct UpdateOptions {
next_version: String,
global_changelog: String,
}
#[allow(dead_code)]
pub type Projects = Vec<Project>;
#[derive(Clone, Debug, Deserialize, Serialize)]
@ -22,7 +24,7 @@ pub enum ProjectType {
#[serde(alias = "rust_workspace")]
RustWorkspace,
#[cfg(feature = "rust-crate")]
#[serde(alias = "json_edit")]
#[serde(alias = "rust_crate")]
RustCrate,
#[cfg(feature = "toml-edit")]
#[serde(alias = "toml_edit")]
@ -35,12 +37,13 @@ pub enum ProjectType {
JsonEdit,
}
#[allow(dead_code)]
impl Project {
pub fn new(path: Option<PathBuf>, r#type: ProjectType) -> Self {
Self { path, r#type }
}
pub fn execute(&self, options: &UpdateOptions) -> anyhow::Result<()> {
pub fn execute(&self, _options: &UpdateOptions) -> anyhow::Result<()> {
match self.r#type {
#[cfg(feature = "rust-workspace")]
ProjectType::RustWorkspace => todo!(),
@ -53,7 +56,5 @@ impl Project {
#[cfg(feature = "json-edit")]
ProjectType::JsonEdit => todo!(),
}
Ok(())
}
}

View File

@ -6,7 +6,7 @@ readme = "../../README.md"
license-file = "../../LICENSE"
version = "0.1.0"
edition = "2021"
publishable = true
publish = true
[dependencies]
cuddle-please-frontend.workspace = true
@ -17,7 +17,7 @@ anyhow.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
dotenv.workspace = true
dotenvy.workspace = true
serde_yaml.workspace = true
serde.workspace = true
reqwest = { workspace = true, features = ["blocking", "json"] }

View File

@ -1,7 +1,7 @@
use cuddle_please_commands::PleaseCommand;
fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
dotenvy::dotenv().ok();
let current_dir = std::env::current_dir().ok();
let current_dir = current_dir.as_deref();

View File

@ -6,6 +6,7 @@ use tracing_test::traced_test;
use crate::common::{assert_output, get_test_data_path};
#[allow(dead_code)]
fn get_base_args<'a>() -> Vec<&'a str> {
vec![
"cuddle-please",
@ -25,7 +26,7 @@ PleaseConfig
api_url: https://some-example.gitea-instance
"#;
#[test]
#[allow(dead_code)]
#[traced_test]
fn test_config_from_current_dir() {
let args = get_base_args();
@ -39,7 +40,7 @@ fn test_config_from_current_dir() {
assert_output(ui, EXPECTED_OUTPUT, "");
}
#[test]
#[allow(dead_code)]
#[traced_test]
fn test_config_from_source_dir() {
let mut args = get_base_args();
@ -55,7 +56,7 @@ fn test_config_from_source_dir() {
assert_output(ui, EXPECTED_OUTPUT, "");
}
#[test]
#[allow(dead_code)]
#[traced_test]
fn test_config_from_stdin() {
let mut args = get_base_args();
@ -75,7 +76,7 @@ settings:
assert_output(ui, EXPECTED_OUTPUT, "");
}
#[test]
#[allow(dead_code)]
#[traced_test]
fn test_config_fails_when_not_path_is_set() {
let args = get_base_args();

View File

@ -16,15 +16,18 @@ fn test_vcs_get_noop() {
#[traced_test]
fn test_vcs_get_git_found() {
let testdata = get_test_data_path("git-found");
if let Err(e) = std::fs::create_dir_all(&testdata) {
tracing::error!("failed to create dir: {}", e);
}
if let Err(e) = std::process::Command::new("git")
.arg("init")
.arg(".")
.current_dir(&testdata)
.output()
{
println!("{e}");
println!("testdata git dir not found: {e}");
}
return;
let git = VcsClient::new_git(&testdata, None::<String>, None::<String>, "".into()).unwrap();
assert_eq!(
git,

View File

@ -16,14 +16,18 @@ please:
branch: main
settings:
api_url: https://git.front.kjuulh.io
actions:
rust:
components:
packages:
debian:
dev:
- jq
- git
release:
- jq
- git
scripts:
"mkdocs:new":