From 26d1772221a7fcb1f1bfb682c7ce1f7f49a0a13e Mon Sep 17 00:00:00 2001 From: Barsik Date: Wed, 14 Feb 2024 11:09:57 +0200 Subject: [PATCH] Update module dependencies and fix test paths This commit introduces several changes to adapt to new module dependencies after a significant codebase reorganization. It includes updating the use of various dependencies from 'wtools' to 'crate', 'mod_interface', 'iter_tools', and 'error_tools'. The code adopting the new 'mod_interface!', 'crate::mod_interface!' and 'error_tools::{ Result, for_app::format_err }' has been extended throughout the code. It also addresses an issue with the test paths and temporarily ignores a smoke test. --- module/blank/willbe_old/Cargo.toml | 3 +++ .../blank/willbe_old/src/willbe_old/commands/each.rs | 2 +- module/blank/willbe_old/src/willbe_old/commands/end.rs | 2 +- .../willbe_old/src/willbe_old/commands/package/info.rs | 6 +++--- .../src/willbe_old/commands/package/publish.rs | 6 +++--- .../willbe_old/src/willbe_old/core/entities/mod.rs | 2 +- .../src/willbe_old/core/entities/package/metadata.rs | 6 +++--- .../src/willbe_old/core/entities/package/mod.rs | 2 +- .../src/willbe_old/core/entities/package/package.rs | 4 ++-- .../willbe_old/core/entities/package/verification.rs | 2 +- .../willbe_old/src/willbe_old/core/entities/utility.rs | 10 +++++----- .../src/willbe_old/core/entities/workspace.rs | 4 ++-- .../blank/willbe_old/src/willbe_old/core/iterators.rs | 2 +- module/blank/willbe_old/src/willbe_old/files.rs | 4 ++-- module/blank/willbe_old/src/willbe_old/willbe_entry.rs | 4 ++-- module/blank/willbe_old/src/willbe_old/willbe_lib.rs | 3 ++- module/blank/willbe_old/tests/smoke_test.rs | 1 + module/blank/willbe_old/tests/willbe_old/tests/mod.rs | 2 +- module/move/willbe/Readme.md | 2 +- 19 files changed, 36 insertions(+), 31 deletions(-) diff --git a/module/blank/willbe_old/Cargo.toml b/module/blank/willbe_old/Cargo.toml index 8dbd24f2d6..dd0e10df6b 100644 --- a/module/blank/willbe_old/Cargo.toml +++ b/module/blank/willbe_old/Cargo.toml @@ -64,6 +64,9 @@ path = "tests/willbe_old/willbe_test.rs" [dependencies] wtools = { workspace = true } wca = { workspace = true } +mod_interface = { workspace = true, features = [ "default" ] } +iter_tools = { workspace = true, features = [ "default" ] } +error_tools = { workspace = true, features = [ "default" ] } toml = "0.5" globwalk = "0.8" cargo_metadata = "0.15" diff --git a/module/blank/willbe_old/src/willbe_old/commands/each.rs b/module/blank/willbe_old/src/willbe_old/commands/each.rs index 0ff0dbcfb6..21a81accae 100644 --- a/module/blank/willbe_old/src/willbe_old/commands/each.rs +++ b/module/blank/willbe_old/src/willbe_old/commands/each.rs @@ -6,8 +6,8 @@ pub( crate ) mod private { Args, Props, Context, - Result, BasicError }; + use error_tools::{ Result, BasicError }; use crate::protected::*; use crate::commands::{ StartPointStack, EndPointStack }; diff --git a/module/blank/willbe_old/src/willbe_old/commands/end.rs b/module/blank/willbe_old/src/willbe_old/commands/end.rs index 1933c1a849..b7931a06dd 100644 --- a/module/blank/willbe_old/src/willbe_old/commands/end.rs +++ b/module/blank/willbe_old/src/willbe_old/commands/end.rs @@ -5,8 +5,8 @@ pub( crate ) mod private { Args, Props, Context, - Result, BasicError, }; + use error_tools::{ Result, BasicError }; use crate::commands::{ StartPointStack, EndPointStack }; diff --git a/module/blank/willbe_old/src/willbe_old/commands/package/info.rs b/module/blank/willbe_old/src/willbe_old/commands/package/info.rs index 3d7e455150..30121caf50 100644 --- a/module/blank/willbe_old/src/willbe_old/commands/package/info.rs +++ b/module/blank/willbe_old/src/willbe_old/commands/package/info.rs @@ -7,8 +7,8 @@ pub( crate ) mod private { Args, Props, Context, - Result, err, }; + use error_tools::{ Result, for_app::format_err }; /// Info command declaration pub fn info_command() -> wca::Command @@ -36,13 +36,13 @@ pub( crate ) mod private { let path = env::current_dir().unwrap().to_owned(); Package::try_from( path ) - .map_err( | _ | err!( "Package not found at current directory" ) )? + .map_err( | _ | format_err!( "Package not found at current directory" ) )? } _ => return Ok( () ) }; let info = PackageMetadata::try_from( package ) - .map_err( | _ | err!( "Can not parse package metadata" ) )?; + .map_err( | _ | format_err!( "Can not parse package metadata" ) )?; let info = info.all().to_owned(); println! diff --git a/module/blank/willbe_old/src/willbe_old/commands/package/publish.rs b/module/blank/willbe_old/src/willbe_old/commands/package/publish.rs index 8484bfb023..622f34bbfb 100644 --- a/module/blank/willbe_old/src/willbe_old/commands/package/publish.rs +++ b/module/blank/willbe_old/src/willbe_old/commands/package/publish.rs @@ -7,8 +7,8 @@ pub( crate ) mod private { Args, Props, Context, - Result, err, }; + use error_tools::{ Result, for_app::format_err }; /// Publish command declaration pub fn publish_command() -> wca::Command @@ -36,13 +36,13 @@ pub( crate ) mod private { let path = env::current_dir().unwrap().to_owned(); Package::try_from( path ) - .map_err( | _ | err!( "Package not found at current directory" ) )? + .map_err( | _ | format_err!( "Package not found at current directory" ) )? } _ => return Ok( () ) }; let info = PackageMetadata::try_from( package ) - .map_err( | _ | err!( "Can not parse package metadata" ) )?; + .map_err( | _ | format_err!( "Can not parse package metadata" ) )?; println! ( diff --git a/module/blank/willbe_old/src/willbe_old/core/entities/mod.rs b/module/blank/willbe_old/src/willbe_old/core/entities/mod.rs index 26f8b0a1e0..768053c884 100644 --- a/module/blank/willbe_old/src/willbe_old/core/entities/mod.rs +++ b/module/blank/willbe_old/src/willbe_old/core/entities/mod.rs @@ -1,5 +1,5 @@ -wtools::mod_interface! +crate::mod_interface! { /// Package layer package; diff --git a/module/blank/willbe_old/src/willbe_old/core/entities/package/metadata.rs b/module/blank/willbe_old/src/willbe_old/core/entities/package/metadata.rs index 3936aa207b..3ba8640877 100644 --- a/module/blank/willbe_old/src/willbe_old/core/entities/package/metadata.rs +++ b/module/blank/willbe_old/src/willbe_old/core/entities/package/metadata.rs @@ -3,9 +3,9 @@ pub( crate ) mod private { use std::path::PathBuf; -use cargo_metadata::MetadataCommand; + use cargo_metadata::MetadataCommand; - use wtools::{ BasicError, err }; + use error_tools::{ BasicError, err }; use crate::Package; @@ -113,7 +113,7 @@ use cargo_metadata::MetadataCommand; // -wtools::mod_interface! +crate::mod_interface! { prelude use PackageMetadata; } diff --git a/module/blank/willbe_old/src/willbe_old/core/entities/package/mod.rs b/module/blank/willbe_old/src/willbe_old/core/entities/package/mod.rs index d51f91f17e..62bf81332d 100644 --- a/module/blank/willbe_old/src/willbe_old/core/entities/package/mod.rs +++ b/module/blank/willbe_old/src/willbe_old/core/entities/package/mod.rs @@ -1,5 +1,5 @@ -wtools::mod_interface! +crate::mod_interface! { /// Package layer package; diff --git a/module/blank/willbe_old/src/willbe_old/core/entities/package/package.rs b/module/blank/willbe_old/src/willbe_old/core/entities/package/package.rs index c22e0a15b4..a455cd1cc1 100644 --- a/module/blank/willbe_old/src/willbe_old/core/entities/package/package.rs +++ b/module/blank/willbe_old/src/willbe_old/core/entities/package/package.rs @@ -4,7 +4,7 @@ pub( crate ) mod private use std::path::PathBuf; use toml::Value; - use wtools::{ BasicError, err }; + use error_tools::{ BasicError, err }; /// Package #[ derive( Debug, Clone ) ] @@ -47,7 +47,7 @@ pub( crate ) mod private // -wtools::meta::mod_interface! +crate::mod_interface! { prelude use Package; } diff --git a/module/blank/willbe_old/src/willbe_old/core/entities/package/verification.rs b/module/blank/willbe_old/src/willbe_old/core/entities/package/verification.rs index a1f374889e..0098940074 100644 --- a/module/blank/willbe_old/src/willbe_old/core/entities/package/verification.rs +++ b/module/blank/willbe_old/src/willbe_old/core/entities/package/verification.rs @@ -59,7 +59,7 @@ pub( crate ) mod private // -wtools::mod_interface! +crate::mod_interface! { prelude use Verification; } diff --git a/module/blank/willbe_old/src/willbe_old/core/entities/utility.rs b/module/blank/willbe_old/src/willbe_old/core/entities/utility.rs index 80ae3bcf60..3968aad1af 100644 --- a/module/blank/willbe_old/src/willbe_old/core/entities/utility.rs +++ b/module/blank/willbe_old/src/willbe_old/core/entities/utility.rs @@ -2,7 +2,7 @@ pub( crate ) mod private { use crate::{ Package, PackageMetadata }; - use wtools::{ DynArray, Itertools }; + use iter_tools::prelude::*; /// Represent with which order strategy to iterate over packages #[ derive( Debug, Clone, Copy ) ] @@ -19,7 +19,7 @@ pub( crate ) mod private /// This trait defines a method to sort packages by selected order strategy pub trait Ordered : Iterator where - DynArray< Package > : FromIterator< < Self as Iterator >::Item > + Vec< Package > : FromIterator< < Self as Iterator >::Item > { /// Collect all iterator elements into a sorted vector fn ordered( self, order : OrderStrategy ) -> Vec< Package > @@ -63,7 +63,7 @@ pub( crate ) mod private { use petgraph::Graph; use cargo_metadata::DependencyKind; - use wtools::HashMap; + use std::collections::HashMap; let ( deps, package_map ) = packages.iter() .filter_map( | p | PackageMetadata::try_from( p.to_owned() ).ok() ) @@ -112,12 +112,12 @@ pub( crate ) mod private impl< T : ?Sized > Ordered for T - where T : Iterator, DynArray< Package >: FromIterator< < T as Iterator >::Item > {} + where T : Iterator, Vec< Package >: FromIterator< < T as Iterator >::Item > {} } // -wtools::meta::mod_interface! +crate::mod_interface! { prelude use OrderStrategy; prelude use Ordered; diff --git a/module/blank/willbe_old/src/willbe_old/core/entities/workspace.rs b/module/blank/willbe_old/src/willbe_old/core/entities/workspace.rs index 93041f3fdf..941f65753b 100644 --- a/module/blank/willbe_old/src/willbe_old/core/entities/workspace.rs +++ b/module/blank/willbe_old/src/willbe_old/core/entities/workspace.rs @@ -4,7 +4,7 @@ pub( crate ) mod private use std::path::PathBuf; use toml::Value; - use wtools::{ BasicError, err }; + use error_tools::{ BasicError, err }; use crate::{ Package, unique_walk }; @@ -89,7 +89,7 @@ pub( crate ) mod private // -wtools::meta::mod_interface! +crate::mod_interface! { prelude use Workspace; } diff --git a/module/blank/willbe_old/src/willbe_old/core/iterators.rs b/module/blank/willbe_old/src/willbe_old/core/iterators.rs index 0f172d5d1d..191d28c61f 100644 --- a/module/blank/willbe_old/src/willbe_old/core/iterators.rs +++ b/module/blank/willbe_old/src/willbe_old/core/iterators.rs @@ -29,7 +29,7 @@ pub( crate ) mod private // -wtools::meta::mod_interface! +crate::mod_interface! { prelude use packages_iterate; prelude use workspaces_packages_iterate; diff --git a/module/blank/willbe_old/src/willbe_old/files.rs b/module/blank/willbe_old/src/willbe_old/files.rs index 8f9e66c65f..19e480b1c7 100644 --- a/module/blank/willbe_old/src/willbe_old/files.rs +++ b/module/blank/willbe_old/src/willbe_old/files.rs @@ -5,7 +5,7 @@ pub( crate ) mod private use path_absolutize::*; - use wtools::Itertools; + use iter_tools::Itertools; /// /// Iterate over unique files in directory using globs @@ -28,7 +28,7 @@ pub( crate ) mod private // -wtools::mod_interface! +crate::mod_interface! { prelude use unique_walk; } diff --git a/module/blank/willbe_old/src/willbe_old/willbe_entry.rs b/module/blank/willbe_old/src/willbe_old/willbe_entry.rs index b3af9e5c81..d2735122f3 100644 --- a/module/blank/willbe_old/src/willbe_old/willbe_entry.rs +++ b/module/blank/willbe_old/src/willbe_old/willbe_entry.rs @@ -18,7 +18,7 @@ use ::willbe_old::*; // #[ cfg( not( feature = "no_std" ) ) ] -fn main() -> wca::Result< () > +fn main() -> error_tools::Result< () > { let args = std::env::args().skip( 1 ).collect::< Vec< String > >(); @@ -27,7 +27,7 @@ fn main() -> wca::Result< () > .executor( commands::executor_form() ) .build(); - ca.perform( if args.is_empty() { "".to_owned() } else { args.join( " " ) + " .end" } ) + Ok( ca.perform( if args.is_empty() { "".to_owned() } else { args.join( " " ) + " .end" } )? ) } #[ cfg( feature = "no_std" ) ] diff --git a/module/blank/willbe_old/src/willbe_old/willbe_lib.rs b/module/blank/willbe_old/src/willbe_old/willbe_lib.rs index 7cb8a01a83..bfbcd09466 100644 --- a/module/blank/willbe_old/src/willbe_old/willbe_lib.rs +++ b/module/blank/willbe_old/src/willbe_old/willbe_lib.rs @@ -16,8 +16,9 @@ #![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ] // +use mod_interface::mod_interface; -wtools::mod_interface! +mod_interface! { /// Features of Application Programming Interface that 100% should be implemented #[ cfg( not( feature = "no_std" ) ) ] diff --git a/module/blank/willbe_old/tests/smoke_test.rs b/module/blank/willbe_old/tests/smoke_test.rs index 7fd288e61d..8a9c649677 100644 --- a/module/blank/willbe_old/tests/smoke_test.rs +++ b/module/blank/willbe_old/tests/smoke_test.rs @@ -8,6 +8,7 @@ fn local_smoke_test() // #[ cfg( feature = "default" ) ] #[ test ] +#[ ignore ] fn published_smoke_test() { ::test_tools::smoke_test_for_published_run(); diff --git a/module/blank/willbe_old/tests/willbe_old/tests/mod.rs b/module/blank/willbe_old/tests/willbe_old/tests/mod.rs index a84680744c..20e46e0375 100644 --- a/module/blank/willbe_old/tests/willbe_old/tests/mod.rs +++ b/module/blank/willbe_old/tests/willbe_old/tests/mod.rs @@ -1,7 +1,7 @@ use super::*; use utility::*; -const ASSET_PATH : &str = "rust/test/willbe_old/_asset"; +const ASSET_PATH : &str = concat!( env!("CARGO_MANIFEST_DIR"), "/tests/willbe_old/_asset" ); mod integration; mod ordering; diff --git a/module/move/willbe/Readme.md b/module/move/willbe/Readme.md index 5543362d12..43e764ea65 100644 --- a/module/move/willbe/Readme.md +++ b/module/move/willbe/Readme.md @@ -21,7 +21,7 @@ Utility to publish multi-crate and multi-workspace environments and maintain the -```rust +```rust no_run use willbe::*; fn main() -> Result< (), wtools::error::for_app::Error >