Compare commits
4 Commits
404d67d459
...
fix/8-prog
| Author | SHA1 | Date | |
|---|---|---|---|
| e053f51bf3 | |||
| f3bfd8c114 | |||
| 131bf15240 | |||
| fd1fe0d896 |
@@ -12,9 +12,13 @@ fn exec_command(command: &mut process::Command) -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("{}", result.unwrap_err());
|
println!("{}", result.unwrap_err());
|
||||||
return Err(
|
|
||||||
"asciidoctor not installed. For more information run docki health!".to_string(),
|
let binary_name = command.get_program().to_str().unwrap_or("Something is");
|
||||||
);
|
|
||||||
|
return Err(format!(
|
||||||
|
"{} not installed. For more information run docki health!",
|
||||||
|
binary_name
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,11 +35,11 @@ fn asciidoctor_docs(in_path: &str, out_path: &str) -> process::Command {
|
|||||||
fn asciidoctor_slides(in_path: &str, out_path: &str, offline_reveal: bool) -> process::Command {
|
fn asciidoctor_slides(in_path: &str, out_path: &str, offline_reveal: bool) -> process::Command {
|
||||||
let mut command = process::Command::new(format!("asciidoctor-revealjs"));
|
let mut command = process::Command::new(format!("asciidoctor-revealjs"));
|
||||||
let out_dir = parent_path(out_path);
|
let out_dir = parent_path(out_path);
|
||||||
let revealjs_path = if offline_reveal {
|
let revealjs_path = if offline_reveal {
|
||||||
path_between(out_dir.to_string(), "./dist/slides/revealjs".to_string())
|
path_between(out_dir.to_string(), "./dist/slides/revealjs".to_string())
|
||||||
} else {
|
} else {
|
||||||
"https://cdn.jsdelivr.net/npm/reveal.js@5.2.1".to_string()
|
"https://cdn.jsdelivr.net/npm/reveal.js@5.2.1".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
command
|
command
|
||||||
.arg(format!("{in_path}"))
|
.arg(format!("{in_path}"))
|
||||||
|
|||||||
@@ -23,10 +23,6 @@ pub fn docki_build(in_path: &str, offline_reveal: bool) -> DockiBuildResult {
|
|||||||
|
|
||||||
DockiBuildResult::Doc(convert_out_path)
|
DockiBuildResult::Doc(convert_out_path)
|
||||||
} else {
|
} else {
|
||||||
if in_path.starts_with("./docs/slides/revealjs") && !offline_reveal {
|
|
||||||
return DockiBuildResult::Silent;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Err(err) = copy(&in_path, &out_path) {
|
if let Err(err) = copy(&in_path, &out_path) {
|
||||||
return DockiBuildResult::Err(err);
|
return DockiBuildResult::Err(err);
|
||||||
}
|
}
|
||||||
@@ -50,5 +46,4 @@ pub enum DockiBuildResult {
|
|||||||
Doc(String),
|
Doc(String),
|
||||||
Copy(String),
|
Copy(String),
|
||||||
Err(String),
|
Err(String),
|
||||||
Silent,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,20 +73,24 @@ impl BuildExecution {
|
|||||||
return Err(result.unwrap_err())
|
return Err(result.unwrap_err())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let paths = paths.into_iter()
|
||||||
|
.filter(|path| offline_reveal || !path.starts_with("./docs/slides/revealjs"))
|
||||||
|
.collect::<Vec<String>>();
|
||||||
|
|
||||||
|
self.goal = paths.len();
|
||||||
|
|
||||||
for (index, in_path) in paths.iter().enumerate() {
|
for (index, in_path) in paths.iter().enumerate() {
|
||||||
self.progress = index + 1;
|
self.progress = index + 1;
|
||||||
self.goal = paths.len();
|
|
||||||
let result = docki_build(&in_path, offline_reveal);
|
let result = docki_build(&in_path, offline_reveal);
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
DockiBuildResult::Err(err) => {
|
DockiBuildResult::Err(err) => {
|
||||||
self.display_building_status("Error", in_path, "");
|
self.display_building_status("Error", &in_path, "");
|
||||||
println!("{}", err)
|
println!("{}", err)
|
||||||
},
|
},
|
||||||
DockiBuildResult::Copy(out_path) => self.display_building_status("Copy", &in_path, &out_path),
|
DockiBuildResult::Copy(out_path) => self.display_building_status("Copy", &in_path, &out_path),
|
||||||
DockiBuildResult::Slide(out_path) => self.display_building_status("Slide", &in_path, &out_path),
|
DockiBuildResult::Slide(out_path) => self.display_building_status("Slide", &in_path, &out_path),
|
||||||
DockiBuildResult::Doc(out_path) => self.display_building_status("Doc", &in_path, &out_path),
|
DockiBuildResult::Doc(out_path) => self.display_building_status("Doc", &in_path, &out_path),
|
||||||
DockiBuildResult::Silent => ()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ fn build_file(paths: Vec<std::path::PathBuf>) {
|
|||||||
display_rebuilding_status("Error", &in_path, "");
|
display_rebuilding_status("Error", &in_path, "");
|
||||||
println!("{}", err);
|
println!("{}", err);
|
||||||
},
|
},
|
||||||
DockiBuildResult::Silent => ()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user