Skip to content

Commit

Permalink
docs update and fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwin Naren <[email protected]>
  • Loading branch information
arihant2math committed Nov 11, 2023
1 parent 1c791f3 commit 94ea201
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dev-scripts/src/update_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn download_artifact(artifact_list: &Vec<Value>, h: HashMap<String, String>, nam
let mut tmp_zip_file = OpenOptions::new().create(true).write(true).open(format!("./tmp/{file}.zip"))?;
tmp_zip_file.write_all(&*download.bytes)?;
let reader = BufReader::new(File::open(format!("./tmp/{file}.zip"))?);
let mut zip = zip::ZipArchive::new(reader).expect("zip read failed");
let mut zip = zip::ZipArchive::new(reader).or_else(|_| Err("Could not open zip file"))?;
let mut file_zip = zip.by_index(0).unwrap();
println!("Extracting {}", file_zip.name());
let mut writer = BufWriter::new(
Expand All @@ -46,7 +46,7 @@ pub fn update_docs(gh_token: &str) -> weather_error::Result<()> {
let mut headers = HashMap::new();
headers.insert("Authorization".to_string(), format!("Bearer {}", gh_token));
let get_run_id = networking::get_url("https://api.github.com/repos/arihant2math/weathercli/actions/runs?per_page=10&status=completed",
None, Some(headers.clone()), None)?;
None, Some(headers.clone()), None)?;
let runs_json: Value = serde_json::from_str(&get_run_id.text)?;
let runs = runs_json["workflow_runs"].as_array()
.ok_or("not an array")?;
Expand All @@ -57,7 +57,7 @@ pub fn update_docs(gh_token: &str) -> weather_error::Result<()> {
let tasks = vec![
["weather (Windows)", "weather.exe"],
["weather (Linux)", "weather"]];
tasks.par_iter().for_each(|&s| download_artifact(&rust_artifacts, headers.clone(), s[0], s[1]).unwrap());
tasks.par_iter().for_each(|&s| { download_artifact(&rust_artifacts, headers.clone(), s[0], s[1]); });
fs::remove_dir_all(working_dir.join("tmp"))?; // TODO: Implement index version updates
update_hash("./docs_templates/weather.exe", "weather-exe-hash-windows")?;
update_hash("./docs_templates/weather", "weather-exe-hash-unix")?;
Expand Down
2 changes: 1 addition & 1 deletion docs_templates/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"weather-ascii-images-hash": "88d3a14ff38704ac6de6f5a3a70034d0953fdea42da8e236fb322af59715d0c5",
"weather-codes-hash": "bfcf6956375369febb0de68d1c2a7e6a2a74e7cfa750c7b16b7e09b57b1af97c",
"weather-exe-hash-unix": "e597bfd269eeb9e995637d83851dc1516b989d599c72fcd30abff35adebcfe87",
"weather-exe-hash-windows": "8a9bf1616e9252cfbf09e838f82a316a2663dd574de04600edece7f94137a661",
"weather-exe-hash-windows": "6d472ac6b4a3ef91547a248607d29a10fb8bb495b0b60cc128fd713f838d2df7",
"weatherd-exe-hash-unix": "e395838c92be917e42d6c3136ea2053901ec6e32a73a80411382ee7c64258065",
"weatherd-exe-hash-windows": "3b1c4e3dd3522aa58626766da2ae96c002fcaa1c3331ae9091d883afa8702a0d"
}
Binary file modified docs_templates/weather.exe
Binary file not shown.

0 comments on commit 94ea201

Please sign in to comment.