-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update readme * update fixture to simple_app * write failing test for generate_cache * fix bad reference to fixture * write comment * fix test * create instructions * Move CLI under packs namespace * extract string helpers into function
- Loading branch information
1 parent
043887e
commit 60ad346
Showing
15 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
pub mod cli; | ||
pub mod packs; | ||
use cli::cli; | ||
use packs::cli; | ||
|
||
pub mod packs; | ||
fn main() { | ||
cli() | ||
cli::run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -463,3 +463,7 @@ mod tests { | |
); | ||
} | ||
} | ||
|
||
pub fn generate_cache(_absolute_root: PathBuf) { | ||
todo!() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
pub(crate) fn to_sentence(list: Vec<String>) -> String { | ||
let mut file_string = String::new(); | ||
// Extract this to src/string_helpers.rs to_sentence function and import it into this | ||
// and invoke it. | ||
for (i, file) in list.iter().enumerate() { | ||
if i == 0 { | ||
file_string.push_str(file); | ||
} else if i == list.len() - 1 { | ||
file_string.push_str(", and "); | ||
file_string.push_str(file); | ||
} else { | ||
file_string.push_str(", "); | ||
file_string.push_str(file); | ||
} | ||
} | ||
|
||
file_string | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use assert_cmd::prelude::*; | ||
use predicates::prelude::*; | ||
use std::{error::Error, process::Command}; | ||
|
||
#[test] | ||
fn test_generate_cache() -> Result<(), Box<dyn Error>> { | ||
Command::cargo_bin("pks")? | ||
.arg("--project-root") | ||
.arg("tests/fixtures/simple_app") | ||
.arg("generate-cache") | ||
.arg("file1.rb") | ||
.arg("file2.rb") | ||
.arg("file3.rb") | ||
.assert() | ||
.success() | ||
.stdout(predicate::str::contains( | ||
"Cache was generated for files file1.rb, file2.rb, and file3.rb\n", | ||
)); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters