Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ path = "module/move/wcensor"
## willbe

[workspace.dependencies.willbe]
version = "~0.21.0"
version = "~0.20.0"
path = "module/move/willbe"


Expand Down
2 changes: 1 addition & 1 deletion module/move/willbe/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# module/move/willbe/Cargo.toml
[package]
name = "willbe"
version = "0.21.0"
version = "0.20.0"
edition = "2021"
authors = [
"Kostiantyn Wandalen <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion module/move/willbe/src/action/cicd_renew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ mod private
let content = handlebars.render( "module_push", &data )?;
file_write( &workflow_file_name, &content )?;

println!( "file_write : {:?}", &workflow_file_name );
println!( "file_write : {}", &workflow_file_name.display() );
}

dbg!( &workflow_root );
Expand Down
20 changes: 10 additions & 10 deletions module/move/willbe/src/action/crate_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ mod private
///
/// # Errors
/// Returns an error if the command arguments are invalid, the workspace cannot be loaded
#[allow(clippy::too_many_lines)]
#[ allow( clippy::too_many_lines, clippy::result_large_err ) ]
pub fn doc
(
workspace : &Workspace,
Expand All @@ -123,17 +123,17 @@ mod private
// --- Get crate name early for --package argument and file naming ---
let manifest_path_for_name = crate_dir.as_ref().join( "Cargo.toml" );
let manifest_content_for_name = fs::read_to_string( &manifest_path_for_name )
.map_err( CrateDocError::Io )
.context( format!( "Failed to read Cargo.toml at {}", manifest_path_for_name.display() ) )
.err_with_report( &report )?;
.map_err( CrateDocError::Io )
.context( format!( "Failed to read Cargo.toml at {}", manifest_path_for_name.display() ) )
.err_with_report( &report )?;
let manifest_toml_for_name = manifest_content_for_name.parse::< Document >()
.map_err( CrateDocError::Toml )
.context( format!( "Failed to parse Cargo.toml at {}", manifest_path_for_name.display() ) )
.err_with_report( &report )?;
.map_err( CrateDocError::Toml )
.context( format!( "Failed to parse Cargo.toml at {}", manifest_path_for_name.display() ) )
.err_with_report( &report )?;
let crate_name = manifest_toml_for_name[ "package" ][ "name" ]
.as_str()
.ok_or_else( || CrateDocError::MissingPackageName( manifest_path_for_name.clone() ) )
.err_with_report( &report )?;
.as_str()
.ok_or_else( || CrateDocError::MissingPackageName( manifest_path_for_name.clone() ) )
.err_with_report( &report )?;
// --- End get crate name early ---

// Define the arguments for `cargo doc`
Expand Down
4 changes: 2 additions & 2 deletions module/move/willbe/src/action/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@ mod private
}

#[ allow( clippy::trivially_copy_pass_by_ref, clippy::needless_lifetimes ) ]
fn process_package_dependency< 'a >
fn process_package_dependency
(
workspace : &Workspace,
package : &WorkspacePackageRef< 'a >,
package : &WorkspacePackageRef< '_ >,
args : &ListOptions,
dep_rep : &mut tool::ListNodeReport,
visited : &mut collection::HashSet< DependencyId >
Expand Down
6 changes: 0 additions & 6 deletions module/move/willbe/src/action/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ mod private
///
/// # Arguments
/// * `patterns` - A vector of patterns specifying the folders to search for packages.
/// * `exclude_dev_dependencies` - A boolean value indicating whether to exclude dev dependencies from manifest before publish.
/// * `dry` - A boolean value indicating whether to perform a dry run.
/// * `temp` - A boolean value indicating whether to use a temporary directory.
///
Expand All @@ -121,8 +120,6 @@ mod private
(
patterns : Vec< String >,
channel : channel::Channel,
exclude_dev_dependencies : bool,
commit_changes : bool,
dry : bool,
temp : bool
)
Expand Down Expand Up @@ -219,7 +216,6 @@ mod private
&tmp,
&packages_to_publish,
dir.clone(),
exclude_dev_dependencies
)?;
let subgraph = subgraph
.map( | _, n | n, | _, e | e );
Expand All @@ -239,8 +235,6 @@ mod private
.channel( channel )
.workspace_dir( CrateDir::try_from( workspace_root_dir ).unwrap() )
.option_base_temp_dir( dir.clone() )
.exclude_dev_dependencies( exclude_dev_dependencies )
.commit_changes( commit_changes )
.dry( dry )
.roots( roots )
.packages( queue )
Expand Down
3 changes: 1 addition & 2 deletions module/move/willbe/src/action/publish_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ mod private
pub struct PublishDiffOptions
{
path : PathBuf,
exclude_dev_dependencies : bool,
keep_archive : Option< PathBuf >,
}

Expand Down Expand Up @@ -169,7 +168,7 @@ mod private
std::fs::write( local_path, content )?;
}
}
diffs.insert( path, crate_diff( &l, &r, o.exclude_dev_dependencies ).exclude( diff::PUBLISH_IGNORE_LIST ) );
diffs.insert( path, crate_diff( &l, &r ).exclude( diff::PUBLISH_IGNORE_LIST ) );
let report = tasks[ current_idx ].info.normal_dependencies.clone();
let printer : Vec< TreePrinter > = report
.iter()
Expand Down
15 changes: 0 additions & 15 deletions module/move/willbe/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ mod private
.kind( Type::String )
.optional( true )
.end()
.property( "exclude_dev_dependencies" )
.hint( "Setting this option to true will temporarily remove development dependencies before executing the command, then restore them afterward. Default is `true`." )
.kind( Type::Bool )
.optional( true )
.end()
.property( "commit_changes" )
.hint( "Indicates whether changes should be committed. Default is `false`." )
.kind( Type::Bool )
.optional( true )
.end()
.property( "dry" )
.hint( "Enables 'dry run'. Does not publish, only simulates. Default is `true`." )
.kind( Type::Bool )
Expand All @@ -59,11 +49,6 @@ mod private
.kind( Type::Path )
.optional( true )
.end()
.property( "exclude_dev_dependencies" )
.hint( "Setting this option to true will temporarily remove development dependencies before executing the command, then restore them afterward. Default is `true`." )
.kind( Type::Bool )
.optional( true )
.end()
.property( "keep_archive" )
.hint( "Save remote package version to the specified path" )
.kind( Type::Path )
Expand Down
12 changes: 1 addition & 11 deletions module/move/willbe/src/command/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ mod private
{
#[ former( default = Channel::Stable ) ]
channel : Channel,
#[ former( default = false ) ]
exclude_dev_dependencies : bool,
#[ former( default = false ) ]
commit_changes : bool,
#[ former( default = true ) ]
dry : bool,
#[ former( default = true ) ]
Expand Down Expand Up @@ -56,12 +52,10 @@ mod private
let PublishProperties
{
channel,
exclude_dev_dependencies,
commit_changes,
dry,
temp
} = o.props.try_into()?;
let plan = action::publish_plan( patterns, channel, exclude_dev_dependencies, commit_changes, dry, temp )
let plan = action::publish_plan( patterns, channel, dry, temp )
.context( "Failed to plan the publication process" )?;

let mut formatted_plan = String::new();
Expand Down Expand Up @@ -116,10 +110,6 @@ mod private
else
{ this };

this = if let Some( v ) = value
.get_owned( "exclude_dev_dependencies" ) { this.exclude_dev_dependencies::< bool >( v ) } else { this };
this = if let Some( v ) = value
.get_owned( "commit_changes" ) { this.commit_changes::< bool >( v ) } else { this };
this = if let Some( v ) = value
.get_owned( "dry" ) { this.dry::< bool >( v ) } else { this };
this = if let Some( v ) = value
Expand Down
13 changes: 2 additions & 11 deletions module/move/willbe/src/command/publish_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ mod private
#[ derive( former::Former ) ]
struct PublishDiffProperties
{
#[ former( default = false ) ]
exclude_dev_dependencies : bool,
keep_archive : Option< PathBuf >,
}

Expand All @@ -38,11 +36,10 @@ mod private
pub fn publish_diff( o : VerifiedCommand ) -> error::untyped::Result< () > // qqq : use typed error
{
let path : PathBuf = o.args.get_owned( 0 ).unwrap_or( std::env::current_dir()? );
let PublishDiffProperties { keep_archive, exclude_dev_dependencies } = o.props.try_into()?;
let PublishDiffProperties { keep_archive } = o.props.try_into()?;

let mut o = action::PublishDiffOptions::former()
.path( path )
.exclude_dev_dependencies( exclude_dev_dependencies );
.path( path );
if let Some( k ) = keep_archive.clone() { o = o.keep_archive( k ); }
let o = o.form();

Expand All @@ -64,12 +61,6 @@ mod private
{
let mut this = Self::former();

this = if let Some( v ) = value
.get_owned( "exclude_dev_dependencies" )
{ this.exclude_dev_dependencies::< bool >( v ) }
else
{ this };

this = if let Some( v ) = value
.get_owned( "keep_archive" )
{ this.keep_archive::< PathBuf >( v ) }
Expand Down
34 changes: 3 additions & 31 deletions module/move/willbe/src/entity/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ mod private
/// # Panics
/// qqq: doc
#[ must_use ]
pub fn crate_diff( left : &CrateArchive, right : &CrateArchive, exclude_dev_dependencies : bool ) -> DiffReport
pub fn crate_diff( left : &CrateArchive, right : &CrateArchive ) -> DiffReport
{
let mut report = DiffReport::default();

Expand All @@ -189,38 +189,10 @@ mod private
{

// unwraps are safe because the paths to the files was compared previously
let mut local = left.content_bytes( path ).unwrap();
let mut remote = right.content_bytes( path ).unwrap();
let local = left.content_bytes( path ).unwrap();
let remote = right.content_bytes( path ).unwrap();


let ( l, r ) = if path.ends_with( "Cargo.toml.orig" ) && exclude_dev_dependencies
{

let local = std::str::from_utf8( left.content_bytes( path ).unwrap() ).unwrap();
let mut local_data = local.parse::< toml_edit::Document >().unwrap();
local_data.remove( "dev-dependencies" );
let local = local_data.to_string().as_bytes().to_vec();


let remote = std::str::from_utf8( right.content_bytes( path ).unwrap() ).unwrap();
let mut remote_data = remote.parse::< toml_edit::Document >().unwrap();
remote_data.remove( "dev-dependencies" );
let remote = remote_data.to_string().as_bytes().to_vec();

( local, remote )
}
else
{
( vec![], vec![] )
};


if !l.is_empty() && !r.is_empty()
{
local = l.as_slice();
remote = r.as_slice();
}

if local == remote
{
report.0.insert( path.to_path_buf(), DiffItem::File( Diff::Same( () ) ) );
Expand Down
2 changes: 1 addition & 1 deletion module/move/willbe/src/entity/files/crate_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl TryFrom< AbsolutePath > for CrateDir
{
if !crate_dir_path.as_ref().join( "Cargo.toml" ).is_file()
{
let err = io::Error::new( io::ErrorKind::InvalidData, format!( "Cannot find crate dir at {crate_dir_path:?}" ) );
let err = io::Error::new( io::ErrorKind::InvalidData, format!( "Cannot find crate dir at {}", crate_dir_path.display() ) );
return Err( PathError::Io( err ) );
}
Ok( Self( crate_dir_path ) )
Expand Down
4 changes: 2 additions & 2 deletions module/move/willbe/src/entity/files/manifest_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ impl TryFrom< AbsolutePath > for ManifestFile

if !manifest_file.as_ref().ends_with( "Cargo.toml" )
{
let err = io::Error::new( io::ErrorKind::Other, format!( "File path does not end with Cargo.toml as it should {manifest_file:?}" ) );
let err = io::Error::other( format!( "File path does not end with Cargo.toml as it should {}", manifest_file.display() ) );
return Err( PathError::Io( err ) );
}

if !manifest_file.as_ref().is_file()
{
let err = io::Error::new( io::ErrorKind::InvalidData, format!( "Cannot find crate dir at {manifest_file:?}" ) );
let err = io::Error::new( io::ErrorKind::InvalidData, format!( "Cannot find crate dir at {}", manifest_file.display() ) );
return Err( PathError::Io( err ) );
}
Ok( Self( manifest_file ) )
Expand Down
4 changes: 2 additions & 2 deletions module/move/willbe/src/entity/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ mod private
/// Panics if the package is not loaded or local package is not packed.
/// # Errors
/// qqq: doc
pub fn publish_need( package : &Package< '_ >, path : Option< path::PathBuf >, exclude_dev_dependencies : bool ) -> Result< bool, PackageError >
pub fn publish_need( package : &Package< '_ >, path : Option< path::PathBuf > ) -> Result< bool, PackageError >
{
let name = package.name()?;
let version = package.version()?;
Expand All @@ -236,7 +236,7 @@ mod private
_ => return Err( PackageError::LoadRemotePackage ),
};

Ok( diff::crate_diff( &local_package, &remote_package, exclude_dev_dependencies ).exclude( diff::PUBLISH_IGNORE_LIST ).has_changes() )
Ok( diff::crate_diff( &local_package, &remote_package ).exclude( diff::PUBLISH_IGNORE_LIST ).has_changes() )
}

}
Expand Down
Loading