Skip to content

Commit

Permalink
Get the resume's updated date from the S3 object's metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed May 17, 2024
1 parent 1433d23 commit 59d9817
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 33 deletions.
1 change: 1 addition & 0 deletions generator/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ATDs = \
$(call atd, sounds) $(call atd, twitch) \
$(call atd, github) $(call atd, practice) \
$(call atd, gallery) $(call atd, project) \
$(call atd, resume)

gen.exe: $(COMMON) $(ATDs) gen.ml
$(BUILDML_OCAMLC) -o $@ $^
Expand Down
14 changes: 8 additions & 6 deletions generator/src/gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,15 @@ let services_snippet = seq [
]
]

let resume_snippet = seq [
h2 @@ text "Resume";
p @@ seq [
a (static "resume-gustav-behm.pdf") @@ text "PDF";
text " (updated 30 Nov 2018)";
let resume_snippet =
let r = Path.meta "resume.json" |> Utils.load_file |> Resume_j.resume_of_string in
seq [
h2 @@ text "Resume";
p @@ seq [
a (static "resume-gustav-behm.pdf") @@ text "PDF";
text @@ sprintf" (updated %s)" r.updated;
]
]
]

let social = seq @@ List.rev [
a "https://github.com/rootmos" @@ svg ~cls:"social" "fa/svgs/brands/github.svg";
Expand Down
3 changes: 3 additions & 0 deletions generator/src/resume.atd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type resume = {
updated: string;
}
4 changes: 4 additions & 0 deletions meta.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ META =
META += sounds.json sounds.sessions.json sounds.demo.json sounds.practice.json
META += github-activity.rootmos.commits.json
META += twitch.rootmos2.json
META += resume.json

META += glenn.json silly.json clips.json

Expand Down Expand Up @@ -34,6 +35,9 @@ github-activity.%.commits.json:
projects.json: $(PROJECTS_SPEC)
$(TASKS_EXE_PREFIX)projects "$<" --output="$@"

resume.json:
$(TASKS_EXE_PREFIX)resume --output="$@"

%.json:
$(TASKS_EXE_PREFIX)gallery list --generate-thumbnails --embed-thumbnails rootmos-static "$*" --output="$@"

Expand Down
1 change: 1 addition & 0 deletions tasks/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ wwwo-sounds = "tasks.sounds:main"
wwwo-twitch = "tasks.twitch:main"
wwwo-upload = "tasks.upload:main"
wwwo-purge = "tasks.purge:main"
wwwo-resume = "tasks.resume:main"
27 changes: 0 additions & 27 deletions tasks/src/tasks/cli.py

This file was deleted.

23 changes: 23 additions & 0 deletions tasks/src/tasks/resume.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import argparse
import json

from .common import output

import boto3

def parse_args():
parser = argparse.ArgumentParser(description="Grab metadata about the resume stored on s3")

parser.add_argument("--output", metavar="OUTPUT")

return parser.parse_args()

def main():
args = parse_args()

s3 = boto3.resource("s3")
obj = s3.Object("rootmos-static", "resume-gustav-behm.pdf")
meta = obj.metadata

with output(args.output) as f:
f.write(json.dumps(meta))

0 comments on commit 59d9817

Please sign in to comment.