Skip to content

Commit

Permalink
auto
Browse files Browse the repository at this point in the history
  • Loading branch information
bestia.dev committed Apr 21, 2024
1 parent 922112d commit d97238c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion automation_tasks_rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fn copy_files_into_module(){
/// cargo build
fn task_build() {
copy_files_into_module();
let _cargo_toml = cl::CargoToml::read();
let cargo_toml = cl::CargoToml::read();
cl::auto_version_increment_semver_or_date();
cl::run_shell_command_static("cargo fmt").unwrap_or_else(|e| panic!("{e}"));
cl::run_shell_command_static("cargo build").unwrap_or_else(|e| panic!("{e}"));
Expand Down
8 changes: 5 additions & 3 deletions template_new_auto/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ pub fn tracing_init() {
// Unset the environment variable RUST_LOG
// unset RUST_LOG
let filter = tracing_subscriber::EnvFilter::from_default_env()
.add_directive("hyper_util=error".parse().unwrap())
.add_directive("reqwest=error".parse().unwrap());
.add_directive("hyper_util=error".parse().unwrap_or_else(|e| panic!("{e}")))
.add_directive("reqwest=error".parse().unwrap_or_else(|e| panic!("{e}")));

tracing_subscriber::fmt()
.with_file(true)
Expand Down Expand Up @@ -173,12 +173,14 @@ fn print_help() {

/// all example commands in one place
fn print_examples_cmd() {
/*
println!(
r#"
{YELLOW}run examples:{RESET}
{GREEN}cargo run --example plantuml1{RESET}
"#
);
*/
}

/// sub-command for bash auto-completion of `cargo auto` using the crate `dev_bestia_cargo_completion`
Expand Down Expand Up @@ -275,7 +277,7 @@ fn task_doc() {
.run().unwrap_or_else(|e| panic!("{e}"));

// pretty html
cl::auto_doc_tidy_html().unwrap();
cl::auto_doc_tidy_html().unwrap_or_else(|e| panic!("{e}"));
cl::run_shell_command_static("cargo fmt").unwrap_or_else(|e| panic!("{e}"));
// message to help user with next move
println!(
Expand Down
8 changes: 5 additions & 3 deletions template_new_cli/automation_tasks_rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ pub fn tracing_init() {
// Unset the environment variable RUST_LOG
// unset RUST_LOG
let filter = tracing_subscriber::EnvFilter::from_default_env()
.add_directive("hyper_util=error".parse().unwrap())
.add_directive("reqwest=error".parse().unwrap());
.add_directive("hyper_util=error".parse().unwrap_or_else(|e| panic!("{e}")))
.add_directive("reqwest=error".parse().unwrap_or_else(|e| panic!("{e}")));

tracing_subscriber::fmt()
.with_file(true)
Expand Down Expand Up @@ -173,12 +173,14 @@ fn print_help() {

/// all example commands in one place
fn print_examples_cmd() {
/*
println!(
r#"
{YELLOW}run examples:{RESET}
{GREEN}cargo run --example plantuml1{RESET}
"#
);
*/
}

/// sub-command for bash auto-completion of `cargo auto` using the crate `dev_bestia_cargo_completion`
Expand Down Expand Up @@ -275,7 +277,7 @@ fn task_doc() {
.run().unwrap_or_else(|e| panic!("{e}"));

// pretty html
cl::auto_doc_tidy_html().unwrap();
cl::auto_doc_tidy_html().unwrap_or_else(|e| panic!("{e}"));
cl::run_shell_command_static("cargo fmt").unwrap_or_else(|e| panic!("{e}"));
// message to help user with next move
println!(
Expand Down
25 changes: 14 additions & 11 deletions template_new_pwa_wasm/automation_tasks_rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub fn tracing_init() {
// Unset the environment variable RUST_LOG
// unset RUST_LOG
let filter = tracing_subscriber::EnvFilter::from_default_env()
.add_directive("hyper_util=error".parse().unwrap())
.add_directive("reqwest=error".parse().unwrap());
.add_directive("hyper_util=error".parse().unwrap_or_else(|e| panic!("{e}")))
.add_directive("reqwest=error".parse().unwrap_or_else(|e| panic!("{e}")));

tracing_subscriber::fmt()
.with_file(true)
Expand Down Expand Up @@ -171,9 +171,12 @@ fn print_help() {
/// all example commands in one place
fn print_examples_cmd() {
/*
println!(r#"{YELLOW}run examples:{RESET}
{GREEN}cargo run --example example1{RESET}
"#);
println!(
r#"
{YELLOW}run examples:{RESET}
{GREEN}cargo run --example plantuml1{RESET}
"#
);
*/
}

Expand Down Expand Up @@ -282,7 +285,7 @@ fn task_doc() {
.run().unwrap_or_else(|e| panic!("{e}"));

// pretty html
cl::auto_doc_tidy_html().unwrap();
cl::auto_doc_tidy_html().unwrap_or_else(|e| panic!("{e}"));
cl::run_shell_command_static("cargo fmt").unwrap_or_else(|e| panic!("{e}"));
// message to help user with next move
println!(
Expand Down Expand Up @@ -458,16 +461,16 @@ fn task_github_new_release() {
// compress files tar.gz
let tar_name = format!("{repo_name}-{tag_name_version}-x86_64-unknown-linux-gnu.tar.gz");
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"tar -zcvf "{tar_name_sanitized_for_double_quote}" "target/release/{repo_name_sanitized_for_double_quote}" "#)
.arg("{tar_name_sanitized_for_double_quote}", &tar_name)
.arg("{repo_name_sanitized_for_double_quote}", &repo_name)
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"tar -zcvf "{tar_name_sanitized_for_double_quote}" "target/release/{repo_name_sanitized_for_double_quote}" "#).unwrap_or_else(|e| panic!("{e}"))
.arg("{tar_name_sanitized_for_double_quote}", &tar_name).unwrap_or_else(|e| panic!("{e}"))
.arg("{repo_name_sanitized_for_double_quote}", &repo_name).unwrap_or_else(|e| panic!("{e}"))
.run().unwrap_or_else(|e| panic!("{e}"));
// upload asset
cgl::github_api_upload_asset_to_release(&github_client, &owner, &repo_name, &release_id, &tar_name);
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"rm "{tar_name_sanitized_for_double_quote}" "#)
.arg("{tar_name_sanitized_for_double_quote}", &tar_name)
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"rm "{tar_name_sanitized_for_double_quote}" "#).unwrap_or_else(|e| panic!("{e}"))
.arg("{tar_name_sanitized_for_double_quote}", &tar_name).unwrap_or_else(|e| panic!("{e}"))
.run().unwrap_or_else(|e| panic!("{e}"));
println!(
Expand Down
25 changes: 14 additions & 11 deletions template_new_wasm/automation_tasks_rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub fn tracing_init() {
// Unset the environment variable RUST_LOG
// unset RUST_LOG
let filter = tracing_subscriber::EnvFilter::from_default_env()
.add_directive("hyper_util=error".parse().unwrap())
.add_directive("reqwest=error".parse().unwrap());
.add_directive("hyper_util=error".parse().unwrap_or_else(|e| panic!("{e}")))
.add_directive("reqwest=error".parse().unwrap_or_else(|e| panic!("{e}")));

tracing_subscriber::fmt()
.with_file(true)
Expand Down Expand Up @@ -171,9 +171,12 @@ fn print_help() {
/// all example commands in one place
fn print_examples_cmd() {
/*
println!(r#"{YELLOW}run examples:{RESET}
{GREEN}cargo run --example example1{RESET}
"#);
println!(
r#"
{YELLOW}run examples:{RESET}
{GREEN}cargo run --example plantuml1{RESET}
"#
);
*/
}

Expand Down Expand Up @@ -282,7 +285,7 @@ fn task_doc() {
.run().unwrap_or_else(|e| panic!("{e}"));

// pretty html
cl::auto_doc_tidy_html().unwrap();
cl::auto_doc_tidy_html().unwrap_or_else(|e| panic!("{e}"));
cl::run_shell_command_static("cargo fmt").unwrap_or_else(|e| panic!("{e}"));
// message to help user with next move
println!(
Expand Down Expand Up @@ -458,16 +461,16 @@ fn task_github_new_release() {
// compress files tar.gz
let tar_name = format!("{repo_name}-{tag_name_version}-x86_64-unknown-linux-gnu.tar.gz");
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"tar -zcvf "{tar_name_sanitized_for_double_quote}" "target/release/{repo_name_sanitized_for_double_quote}" "#)
.arg("{tar_name_sanitized_for_double_quote}", &tar_name)
.arg("{repo_name_sanitized_for_double_quote}", &repo_name)
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"tar -zcvf "{tar_name_sanitized_for_double_quote}" "target/release/{repo_name_sanitized_for_double_quote}" "#).unwrap_or_else(|e| panic!("{e}"))
.arg("{tar_name_sanitized_for_double_quote}", &tar_name).unwrap_or_else(|e| panic!("{e}"))
.arg("{repo_name_sanitized_for_double_quote}", &repo_name).unwrap_or_else(|e| panic!("{e}"))
.run().unwrap_or_else(|e| panic!("{e}"));
// upload asset
cgl::github_api_upload_asset_to_release(&github_client, &owner, &repo_name, &release_id, &tar_name);
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"rm "{tar_name_sanitized_for_double_quote}" "#)
.arg("{tar_name_sanitized_for_double_quote}", &tar_name)
cl::ShellCommandLimitedDoubleQuotesSanitizer::new(r#"rm "{tar_name_sanitized_for_double_quote}" "#).unwrap_or_else(|e| panic!("{e}"))
.arg("{tar_name_sanitized_for_double_quote}", &tar_name).unwrap_or_else(|e| panic!("{e}"))
.run().unwrap_or_else(|e| panic!("{e}"));
println!(
Expand Down

0 comments on commit d97238c

Please sign in to comment.