Skip to main content

socketry_project/
lib.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4//! Shared Socketry Rust project conventions and development tasks.
5//!
6//! Add this crate to a private `bake/` package to link the standard project
7//! tasks and their published agent context into a repository.
8use bake::{Context, Result};
9use bake_agent_context as _;
10use bake_cargo as _;
11use bake_license as _;
12use bake_readme as _;
13use bake_releases as _;
14use bake_test_rust as _;
15
16/// Refresh the standard project files after a Cargo version bump.
17#[bake::task(name = "cargo:after_version_bump")]
18pub fn after_version_bump(context: &mut Context, version: String) -> Result<()> {
19    context.call("license:update", &[])?;
20    context.call("releases:update", &[&format!("v{version}")])?;
21    context.call("readme:update", &[])?;
22    Ok(())
23}
24
25#[cfg(test)]
26mod tests {
27    use bake::Registry;
28
29    #[test]
30    fn registers_the_project_version_bump_hook() {
31        let registry = Registry::discover().unwrap();
32        assert!(
33            registry
34                .tasks()
35                .any(|task| task.name() == "cargo:after_version_bump")
36        );
37    }
38}