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: 0.8.65 date: 2022-10-17 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
In your rust project root directory (where the Cargo.toml is)
first install cargo-auto and generate a new helper project:
cargo install cargo-auto
cargo auto new
In a new editor open the generated directory automation_tasks_rs
as an independent rust project. There is already this dependency in Cargo.toml
:
cargo_auto_lib="0.8.60"
Preview the code and observe all the auto_*
functions from cargo_auto_lib
.
Example:
fn task_release() {
auto_semver_increment_patch();
auto_cargo_toml_to_md();
auto_lines_of_code("");
auto_build();
}
Go back to your main rust project.
Add markers to the beginning of README.md (don't copy the numbers 1 and 2):
1 [//]: # (auto_cargo_toml_to_md start)
2 [//]: # (auto_cargo_toml_to_md end)
Run (in your main rust project):
cargo auto release
With a little luck, it included the data of Cargo.toml into the README.md
inside the markers:
based on simple functions
All the functions have extensive help/docs to describe how they work.
It is nice when you use a code editor with IntelliSense like VSCode.
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!
learn something new every day
I needed to copy large text into doc comments.
It means every line must get a prefix like ///
.
In VSCode I selected the text, press
alt+shift+i
Now I have multiple cursors
on the end of every selected lines.
I press the key
home
And now I have multiple cursors on the beginning of every line.
I type (insert):
///
and it's done ! Great !
TODO
Automate badges for crates.io, doc.rs, lib.rs, license, crev review. Check if they exist and create badges.
cargo crev reviews and advisory
We live in times of danger with supply chain attacks.
It is recommended to always use cargo-crev
to verify the trustworthiness of each of your dependencies.
Please, spread this info.
You can also read reviews quickly on the web:
https://web.crev.dev/rust-reviews/crates/
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