diff --git a/Cargo.toml b/Cargo.toml index afee6a0..b2892e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rdocs" -version = "0.1.39" +version = "0.1.40" edition = "2021" repository = "https://github.com/daniellga/rdocs/" diff --git a/rdocs/DESCRIPTION b/rdocs/DESCRIPTION index 64aa643..05d58ff 100644 --- a/rdocs/DESCRIPTION +++ b/rdocs/DESCRIPTION @@ -1,6 +1,6 @@ Package: rdocs Title: Create Quarto documentation for R files from comments -Version: 0.1.39 +Version: 0.1.40 Authors@R: person("Daniel", "Gurgel", , "daniellga@gmail.com", role = c("aut", "cre")) Description: Generate R documentation in Quarto format based on comments in code files. diff --git a/src/main.rs b/src/main.rs index a6913c1..526cf35 100644 --- a/src/main.rs +++ b/src/main.rs @@ -179,8 +179,8 @@ fn output_file(hash: HashMap>, folder_name_hidden: &str) { let docs_file_path = contents_folder.join(&key_lowercase).with_extension("qmd"); // Create the folders if they don't exist. - std::fs::create_dir_all(folder_name_hidden).expect("directory could not be created"); - std::fs::create_dir_all(contents_folder).expect("directory could not be created"); + std::fs::create_dir_all(folder_name_hidden).expect("Directory could not be created."); + std::fs::create_dir_all(contents_folder).expect("Directory could not be created."); let title = format!("title: {}", key); let text = ["---", &title, "---"].join("\n"); @@ -189,10 +189,10 @@ fn output_file(hash: HashMap>, folder_name_hidden: &str) { let output_text = [text, value.join("\n")].join("\n\n"); // Write the output text to the output file. - let mut output_file = File::create(&docs_file_path).expect("could not create output_file"); + let mut output_file = File::create(&docs_file_path).expect("Could not create output_file."); output_file .write_all(output_text.as_bytes()) - .expect("could not write to output_file"); + .expect("Could not write to output_file."); } } @@ -205,11 +205,14 @@ fn eval_examples(examples: Vec) { .stdout(Stdio::null()) .stderr(Stdio::piped()) .output() - .expect("Failed to execute Rscript"); + .expect("Failed to execute Rscript."); if !output.status.success() { let error_message = String::from_utf8_lossy(&output.stderr); - panic!("Error running example:\n{}", error_message); + panic!( + "Error running example:\n\n{}\n\n**********\n\nR code executed:\n\n{}", + error_message, output_text + ); } }