added async stuff not pushed in the last commit

This commit is contained in:
2023-03-12 21:17:51 +01:00
parent cc77e4ef9c
commit f0007394c3
3 changed files with 6 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
use super::executions::build_execution::BuildExecution; use super::executions::build_execution::BuildExecution;
pub fn build() -> () { pub async fn build() -> () {
let mut build_execution = BuildExecution::new(); let mut build_execution = BuildExecution::new();
build_execution.execute().expect("build failed") build_execution.execute().await.expect("build failed")
} }

View File

@@ -25,14 +25,14 @@ impl BuildExecution {
}; };
} }
pub fn execute(&mut self) -> Result<(), String> { pub async 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 Err("docs directory does not exist it. Create it or use the template".to_string()) return Err("docs directory does not exist it. Create it or use the template".to_string())
} }
if let Err(error) = Self::prepare() { if let Err(error) = Self::prepare().await {
return Err(error); return Err(error);
} }
@@ -100,7 +100,7 @@ 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> { async fn prepare() -> Result<(), String> {
let reveal_version = "3.9.2"; let reveal_version = "3.9.2";
let target = format!("https://github.com/hakimel/reveal.js/archive/{reveal_version}.zip"); let target = format!("https://github.com/hakimel/reveal.js/archive/{reveal_version}.zip");

View File

@@ -4,7 +4,7 @@ use crate::app::fs_util;
const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5"; const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5";
pub fn install_reveal() -> () { pub async fn install_reveal() -> () {
let result = reqwest::blocking::get(url()) let result = reqwest::blocking::get(url())
.expect("Could not download reveal. Make sure you are connected to the internet"); .expect("Could not download reveal. Make sure you are connected to the internet");