summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--update.scm55
1 files changed, 29 insertions, 26 deletions
diff --git a/update.scm b/update.scm
index 3716984..45dfd65 100644
--- a/update.scm
+++ b/update.scm
@@ -48,29 +48,32 @@
(display data port)))
(simple-format #t "written ~A\n" output)))))
-(for-each
- (match-lambda
- ((year . weeks)
- (for-each
- (lambda (week)
- (let ((week-string
- (format #f "~2'0d" week)))
- (let ((week-end-date
- (lookup-end-date-for-week year week)))
- (when (time>? (current-time)
- (date->time-utc week-end-date))
- (unless (file-exists?
- (compare-data-filename-for-week year week))
- (download-data-for-week year week)))
- (let ((filename
- (format
- #f "posts/~d/~2'0d/en_US.md"
- year week)))
- (mkdir-p (dirname filename))
- (when (not (file-exists? filename))
- (call-with-output-file filename
- (lambda (port)
- (display "---\n" port)))
- (simple-format #t "written ~A\n" filename))))))
- (map car weeks))))
- %week-start-lookup-data)
+(define (update)
+ (for-each
+ (match-lambda
+ ((year . weeks)
+ (for-each
+ (lambda (week)
+ (let ((week-string
+ (format #f "~2'0d" week)))
+ (let ((week-end-date
+ (lookup-end-date-for-week year week)))
+ (when (time>? (current-time)
+ (date->time-utc week-end-date))
+ (unless (file-exists?
+ (compare-data-filename-for-week year week))
+ (download-data-for-week year week)))
+ (let ((filename
+ (format
+ #f "posts/~d/~2'0d/en_US.md"
+ year week)))
+ (mkdir-p (dirname filename))
+ (when (not (file-exists? filename))
+ (call-with-output-file filename
+ (lambda (port)
+ (display "---\n" port)))
+ (simple-format #t "written ~A\n" filename))))))
+ (map car weeks))))
+ %week-start-lookup-data))
+
+(update)