From 3584435695f862e2c2383136e8d3a996b9a0e174 Mon Sep 17 00:00:00 2001 From: dcodesdev <101001810+dcodesdev@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:30:50 +0300 Subject: [PATCH] readme md --- challenges/tests.rs | 8 ++------ crates/cli/src/challenge.rs | 2 +- crates/cli/src/download.rs | 13 ++++--------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/challenges/tests.rs b/challenges/tests.rs index 68253c8..313f128 100644 --- a/challenges/tests.rs +++ b/challenges/tests.rs @@ -87,17 +87,13 @@ mod tests { for challenge_dir in challenges { let dir_name = challenge_dir.file_name().unwrap().to_str().unwrap(); - let description_md = challenge_dir.join("description.md"); + let readme_md = challenge_dir.join("README.md"); let cargo_toml = challenge_dir.join("Cargo.toml"); let src_lib = challenge_dir.join("src/lib.rs"); let src_starter = challenge_dir.join("src/starter.rs"); let tests = challenge_dir.join("tests/tests.rs"); - assert!( - description_md.exists(), - "Missing description.md in {}", - dir_name - ); + assert!(readme_md.exists(), "Missing README.md in {}", dir_name); assert!(cargo_toml.exists(), "Missing Cargo.toml in {}", dir_name); assert!(src_lib.exists(), "Missing src/lib.rs in {}", dir_name); assert!(tests.exists(), "Missing tests, you should have either src/tests.rs or tests/tests.rs available in {}", dir_name); diff --git a/crates/cli/src/challenge.rs b/crates/cli/src/challenge.rs index 365dfc2..2eba518 100644 --- a/crates/cli/src/challenge.rs +++ b/crates/cli/src/challenge.rs @@ -1,6 +1,6 @@ pub async fn challenge_exists(challenge: &str) -> anyhow::Result { let url = "https://raw.githubusercontent.com/dcodesdev/rustfinity.com/main"; - let url = format!("{}/challenges/{}/description.md", url, challenge); + let url = format!("{}/challenges/{}/README.md", url, challenge); let client = reqwest::Client::new(); let text = client.get(url).send().await?.text().await?; diff --git a/crates/cli/src/download.rs b/crates/cli/src/download.rs index 88512a3..516e943 100644 --- a/crates/cli/src/download.rs +++ b/crates/cli/src/download.rs @@ -3,7 +3,7 @@ use dload::Downloader; use futures::future::join_all; const FILES: [&'static str; 4] = [ - "description.md", + "README.md", "Cargo.toml", "src/starter.rs", "tests/tests.rs", @@ -103,12 +103,7 @@ mod tests { .await .expect("Failed to download challenge"); - let paths_to_exist = [ - "description.md", - "Cargo.toml", - "src/lib.rs", - "tests/tests.rs", - ]; + let paths_to_exist = ["README.md", "Cargo.toml", "src/lib.rs", "tests/tests.rs"]; for file in paths_to_exist.iter() { let path = format!("{}/{}", challenge, file); @@ -134,14 +129,14 @@ mod tests { fs::create_dir_all("temp/test_downloads_file").ok(); env::set_current_dir("temp/test_downloads_file").ok(); - let url = "https://raw.githubusercontent.com/dcodesdev/rustfinity.com/main/challenges/hello-world/description.md"; + let url = "https://raw.githubusercontent.com/dcodesdev/rustfinity.com/main/challenges/hello-world/src/lib.rs"; let challenge = "hello-world"; let result = download_file(url, challenge).await; assert!(result.is_ok()); - let path = format!("{}/description.md", challenge); + let path = format!("{}/README.md", challenge); assert!(Path::new(&path).exists()); // read the contents of the file