From eba795a0063446cc0930021038e47170e43c9912 Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman <4752801+elizabethengelman@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:10:20 -0500 Subject: [PATCH] Print out progress of copy_template_files --- Cargo.lock | 35 +++++++++++++++++++ cmd/soroban-cli/Cargo.toml | 2 +- cmd/soroban-cli/src/commands/contract/init.rs | 11 ++---- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e297faa4b..7c6639934 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3064,6 +3064,40 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rust-embed" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82c0bbc10308ed323529fd3c1dce8badda635aa319a5ff0e6466f33b8101e3f" +dependencies = [ + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6227c01b1783cdfee1bcf844eb44594cd16ec71c35305bf1c9fb5aade2735e16" +dependencies = [ + "proc-macro2", + "quote", + "rust-embed-utils", + "syn 2.0.39", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cb0a25bfbb2d4b4402179c2cf030387d9990857ce08a32592c6238db9fa8665" +dependencies = [ + "sha2 0.10.8", + "walkdir", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -3512,6 +3546,7 @@ dependencies = [ "rand", "regex", "rpassword", + "rust-embed", "sep5", "serde", "serde-aux", diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index 5f408fcf6..49043e544 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -105,7 +105,7 @@ ureq = {version = "2.9.1", features = ["json"]} tempfile = "3.8.1" toml_edit = "0.21.0" -rust-embed = "8.2.0" +rust-embed = { version = "8.2.0", features = ["debug-embed"] } # For hyper-tls [target.'cfg(unix)'.dependencies] openssl = { version = "0.10.55", features = ["vendored"] } diff --git a/cmd/soroban-cli/src/commands/contract/init.rs b/cmd/soroban-cli/src/commands/contract/init.rs index 6362bc463..3d729ff63 100644 --- a/cmd/soroban-cli/src/commands/contract/init.rs +++ b/cmd/soroban-cli/src/commands/contract/init.rs @@ -6,7 +6,7 @@ use std::fs::read_to_string; use std::num::NonZeroU32; use std::path::Path; use std::sync::atomic::AtomicBool; -use std::{env, fs, io}; +use std::{fs, io}; use toml_edit::{Document, Formatted, InlineTable, TomlError, Value}; const SOROBAN_EXAMPLES_URL: &str = "https://github.com/stellar/soroban-examples.git"; @@ -142,14 +142,6 @@ fn init( frontend_template: &String, with_examples: &[String], ) -> Result<(), Error> { - let cli_cmd_root = env!("CARGO_MANIFEST_DIR"); - let template_dir_path = Path::new(cli_cmd_root) - .join("src") - .join("utils") - .join("contract-init-template"); - - println!("template_dir_path: {template_dir_path:?}",); - // create a project dir, and copy the contents of the base template (contract-init-template) into it std::fs::create_dir_all(project_path).map_err(|e| { eprintln!("Error creating new project directory: {project_path:?}"); @@ -222,6 +214,7 @@ fn copy_template_files(project_path: &Path) -> Result<(), Error> { e })?; + println!("➕ Writing {}", &to.to_string_lossy()); fs::write(&to, file_contents).map_err(|e| { eprintln!("Error writing file: {to:?}"); e