Skip to content

Commit 7d8a1d2

Browse files
committed
Update dependencies and adapt to them
1 parent e4f867e commit 7d8a1d2

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
[package]
22
name = "showcase"
33
version = "0.1.0"
4-
authors = ["Jorge Aparicio <jorge@japaric.io>"]
5-
edition = "2018"
4+
authors = [
5+
"Jorge Aparicio <jorge@japaric.io>",
6+
"The Rust Embedded Resources Team and Contributors <resources@teams.rust-embedded.org>",
7+
]
8+
edition = "2021"
69

710
[dependencies]
8-
tera = "0.11.20"
11+
tera = "1.17"
912
serde_derive = "1.0.80"
1013
serde = "1.0.80"
11-
serde_yaml = "0.8.8"
14+
serde_yaml = "0.9.17"
1215
maplit = "1.0.1"
1316
failure = "0.1.3"
1417
exitfailure = "0.5.1"
1518
fs_extra = "1.1.0"
16-
chrono = "0.4.6"
19+
chrono = "0.4.23"

src/main.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
use std::{fs, path::Path};
44

5-
use chrono::{Date, NaiveDate, Utc};
5+
use chrono::{TimeZone, Utc};
66
use exitfailure::ExitFailure;
77
use failure::{bail, SyncFailure};
88
use fs_extra::dir::{self, CopyOptions};
9-
use maplit::hashmap;
109
use serde_derive::{Deserialize, Serialize};
11-
use tera::Tera;
10+
use tera::{Context, Tera};
1211

1312
const MAX_DESCRIPTION_SIZE: usize = 280; // characters (assuming ASCII)
1413

@@ -33,9 +32,9 @@ fn run() -> Result<(), failure::Error> {
3332

3433
// rotate the project list so that the first entry is not always shown at the top
3534
// (we rebuild the site on a daily basis)
36-
let start = Date::from_utc(NaiveDate::from_ymd(2019, 03, 04), Utc);
35+
let start = Utc.with_ymd_and_hms(2019, 03, 04, 0, 0, 0).unwrap();
3736
let nprojects = projects.len();
38-
projects.rotate_left(((Utc::today() - start).num_days() as usize) % nprojects);
37+
projects.rotate_left(((Utc::now() - start).num_days() as usize) % nprojects);
3938

4039
for project in &mut projects {
4140
if project.description.len() > MAX_DESCRIPTION_SIZE {
@@ -66,8 +65,10 @@ fn run() -> Result<(), failure::Error> {
6665
}
6766
}
6867

68+
let mut context = Context::new();
69+
context.insert("projects", &projects);
6970
let index = tera
70-
.render("index.html", &hashmap! { "projects" => projects })
71+
.render("index.html", &context)
7172
.map_err(SyncFailure::new)?;
7273

7374
fs::remove_dir_all("public").ok();

0 commit comments

Comments
 (0)