Skip to content

Commit

Permalink
Fix needing to rerun cargo on each koan
Browse files Browse the repository at this point in the history
  • Loading branch information
imbstack committed May 29, 2017
1 parent 7909361 commit d50f00d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
18 changes: 15 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
use std::fs::{OpenOptions};
use std::io::{Write,ErrorKind};

fn main() {
OpenOptions::new().create(true)
let path = OpenOptions::new().create_new(true)
.write(true)
.open("src/path_to_enlightenment.rs")
.unwrap();
.open("src/path_to_enlightenment.rs");

match path {
Err(error) => {
match error.kind() {
ErrorKind::AlreadyExists => {},
_ => panic!("{}", error),
}
},
Ok(f) => {
write!(&f, "koan!(\"the_truth\");\n").unwrap();
},
}
}
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ fn seek_the_path() -> bool {

#[cfg(not(test))]
fn walk_the_path() -> bool {
Command::new("cargo")
.arg("clean")
.status()
.unwrap()
.success();
Command::new("cargo")
.arg("test")
.arg("-q")
Expand Down

0 comments on commit d50f00d

Please sign in to comment.