extracting the revealjs stuff is working
This commit is contained in:
1086
Cargo.lock
generated
1086
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -8,3 +8,6 @@ license-file = "LICENSE.txt"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
async-trait = "0.1.63"
|
||||||
|
reqwest = {version = "0.11.14", features = ["blocking"]}
|
||||||
|
zip-extract = "0.1.1"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::{fs, path::Path};
|
use std::{fs::{self, File}, path::{Path, PathBuf}, io::{Write, Cursor}};
|
||||||
|
|
||||||
use crate::app::{
|
use crate::app::{
|
||||||
builder::{
|
builder::{
|
||||||
@@ -27,10 +27,15 @@ impl BuildExecution {
|
|||||||
|
|
||||||
pub fn execute(&mut self) -> Result<(), String> {
|
pub fn execute(&mut self) -> Result<(), String> {
|
||||||
let path = "./docs/".to_string();
|
let path = "./docs/".to_string();
|
||||||
|
|
||||||
if !Self::directory_exists(&path) {
|
if !Self::directory_exists(&path) {
|
||||||
return Self::docs_directory_missing();
|
return Self::docs_directory_missing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Err(error) = Self::prepare() {
|
||||||
|
return Err(error);
|
||||||
|
}
|
||||||
|
|
||||||
return self.build_dir(&path);
|
return self.build_dir(&path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +100,27 @@ impl BuildExecution {
|
|||||||
self.build_file_and_status(&self.doc_builder, in_path, out_path, "doc");
|
self.build_file_and_status(&self.doc_builder, in_path, out_path, "doc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn prepare() -> Result<(), String> {
|
||||||
|
let reveal_version = "3.9.2";
|
||||||
|
let target = format!("https://github.com/hakimel/reveal.js/archive/{reveal_version}.zip");
|
||||||
|
|
||||||
|
let Ok(response) = reqwest::blocking::get(target) else {
|
||||||
|
return Err("could not downlaod revealjs".to_string())
|
||||||
|
};
|
||||||
|
|
||||||
|
let Ok(bytes) = response.bytes() else {
|
||||||
|
return Err("could not extract bytes".to_string())
|
||||||
|
};
|
||||||
|
|
||||||
|
let out = PathBuf::from("./docs/slides/revealjs");
|
||||||
|
|
||||||
|
if zip_extract::extract(Cursor::new(bytes), &out, true).is_err() {
|
||||||
|
return Err("could not write extracted archive to disk".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn build_slide(&self, in_path: &str, out_path: &str) {
|
fn build_slide(&self, in_path: &str, out_path: &str) {
|
||||||
self.build_file_and_status(&self.slide_builder, in_path, out_path, "slide");
|
self.build_file_and_status(&self.slide_builder, in_path, out_path, "slide");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user