From 4b19b409ecc0789272a44c16760c223a1965590e Mon Sep 17 00:00:00 2001 From: ndkazu Date: Wed, 1 Jan 2025 11:30:08 +0900 Subject: [PATCH] Fixing CI errors --- crates/pop-cli/src/commands/build/mod.rs | 2 +- crates/pop-cli/src/commands/call/contract.rs | 3 ++- crates/pop-cli/src/commands/up/contract.rs | 6 ++---- crates/pop-cli/src/common/builds.rs | 11 +++++++++++ crates/pop-cli/src/common/contracts.rs | 9 --------- crates/pop-cli/src/common/mod.rs | 1 + 6 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 crates/pop-cli/src/common/builds.rs diff --git a/crates/pop-cli/src/commands/build/mod.rs b/crates/pop-cli/src/commands/build/mod.rs index 0403a846..1f805f8d 100644 --- a/crates/pop-cli/src/commands/build/mod.rs +++ b/crates/pop-cli/src/commands/build/mod.rs @@ -2,7 +2,7 @@ use crate::{ cli::{self, Cli}, - common::contracts::get_project_path, + common::builds::get_project_path, }; use clap::{Args, Subcommand}; #[cfg(feature = "contract")] diff --git a/crates/pop-cli/src/commands/call/contract.rs b/crates/pop-cli/src/commands/call/contract.rs index f383d394..629ca204 100644 --- a/crates/pop-cli/src/commands/call/contract.rs +++ b/crates/pop-cli/src/commands/call/contract.rs @@ -3,7 +3,8 @@ use crate::{ cli::{self, traits::*}, common::{ - contracts::{get_project_path, has_contract_been_built}, + builds::get_project_path, + contracts::has_contract_been_built, wallet::{prompt_to_use_wallet, request_signature}, }, }; diff --git a/crates/pop-cli/src/commands/up/contract.rs b/crates/pop-cli/src/commands/up/contract.rs index 7300ec7c..c11e55e5 100644 --- a/crates/pop-cli/src/commands/up/contract.rs +++ b/crates/pop-cli/src/commands/up/contract.rs @@ -3,10 +3,8 @@ use crate::{ cli::{traits::Cli as _, Cli}, common::{ - contracts::{ - check_contracts_node_and_prompt, get_project_path, has_contract_been_built, - terminate_node, - }, + builds::get_project_path, + contracts::{check_contracts_node_and_prompt, has_contract_been_built, terminate_node}, wallet::request_signature, }, style::style, diff --git a/crates/pop-cli/src/common/builds.rs b/crates/pop-cli/src/common/builds.rs new file mode 100644 index 00000000..5d0aa37d --- /dev/null +++ b/crates/pop-cli/src/common/builds.rs @@ -0,0 +1,11 @@ +use std::path::PathBuf; + +/// This method is used to get the proper project path format (with or without cli flag) +pub fn get_project_path(path_flag: Option, path_pos: Option) -> Option { + let project_path = if let Some(ref path) = path_pos { + Some(path) // Use positional path if present + } else { + path_flag.as_ref() // Otherwise, use the named path + }; + project_path.cloned() +} diff --git a/crates/pop-cli/src/common/contracts.rs b/crates/pop-cli/src/common/contracts.rs index d3b16a93..a3b8f878 100644 --- a/crates/pop-cli/src/common/contracts.rs +++ b/crates/pop-cli/src/common/contracts.rs @@ -126,15 +126,6 @@ pub fn has_contract_been_built(path: Option<&Path>) -> bool { .unwrap_or_default() } -pub fn get_project_path(path_flag: Option, path_pos: Option) -> Option { - let project_path = if let Some(ref path) = path_pos { - Some(path) // Use positional path if present - } else { - path_flag.as_ref() // Otherwise, use the named path - }; - project_path.cloned() -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/pop-cli/src/common/mod.rs b/crates/pop-cli/src/common/mod.rs index 4a89036e..512d2a67 100644 --- a/crates/pop-cli/src/common/mod.rs +++ b/crates/pop-cli/src/common/mod.rs @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 +pub mod builds; #[cfg(feature = "contract")] pub mod contracts; pub mod helpers;