cargo_auto_lib
Library crate for common tasks when building rust projects. Intended for use with cargo-auto - automation tasks written in Rust language.
version: 1.2.4 date: 2024-02-20 author: Bestia.dev repository: GitHub
Hashtags: #rustlang #buildtool #developmenttool
My projects on GitHub are more like a tutorial than a finished product: bestia-dev tutorials.
Try it
First, install the tool for task automation in Rust projects:
Generate a new Rust CLI project:
Open the hello_world
project in VSCode:
Open the generated directory automation_tasks_rs
as an independent rust project in VSCode.
Now we can analyze the automation code. There is already the dependency inside Cargo.toml
for our library:
="1.1.2"
Review the code in automation_tasks_rs/main.rs
. The cl::
namespace is the alias for cargo_auto_lib
.
Example:
/// cargo build --release
You can see this function will increment the version in Cargo.toml.
Then it will copy some data from Cargo.toml to README.md (title, description, version, author,...).
It will count the lines of code and create badges in README.md.
Then comes the traditional Rust part: cargo fmt and cargo build --release.
Finally, it will show on the screen the instructions on how to continue developing.
Run (in your main rust project):
Now open the README.md and you will see the data that this automation task copied from other places. Therefore you change this data only in one place, the automation task copies them wherever needed.
Caveats
This crate will attempt to edit Cargo.toml
. Unfortunately, there's no great robust way right now to edit TOML file preserving formatting and comments and such, so right now I use just regex to do this.
If you find that the heuristics don't work for you though please let me know and I'll try to check in a fix!
Development details
Read the development details in a separate md file:
DEVELOPMENT.md
Releases changelog
Read the release changelog in a separate md file:
RELEASES.md
TODO
Use the new #![doc=include_str!("README.md")]
to avoid super clutter in lib.rs
doc comments.
Automate badges for crates.io, doc.rs, lib.rs, license, crev review. Check if they exist and create badges.
Create a git tag, a GitHub release and at the same time RELEASES.md after publishing on crates.io.
There is no binary upload for library releases.
Open-source and free as a beer
My open-source projects are free as a beer (MIT license).
I just love programming.
But I need also to drink. If you find my projects and tutorials helpful, please buy me a beer by donating to my PayPal.
You know the price of a beer in your local bar ;-)
So I can drink a free beer for your health :-)
Na zdravje! Alla salute! Prost! Nazdravlje! 🍻
//bestia.dev
//github.com/bestia-dev
//bestiadev.substack.com
//youtube.com/@bestia-dev-tutorials