meta/new-web: minor repairs and sync script

This commit is contained in:
Matthew Flatt 2014-03-12 05:36:30 -06:00
parent 06682cf234
commit 5efd997226
5 changed files with 92 additions and 6 deletions

View File

@ -36,3 +36,11 @@ To build:
* Set the $GIT_DIR environment variable to point to the ".git"
directory of a Racket repository if you want to extract release
information from a repository other than the enclosing one.
To upload:
==========
* You'll need credentials to upload to S3, and those credentials
should be in "~/.aws-keys".
* Run the "sync.rkt" script: racket -l meta/new-web/sync

View File

@ -1,10 +1,13 @@
#lang plt-web
(require "resources.rkt"
"data.rkt"
plt-web/indexes
version/utils)
(provide (all-defined-out))
(define download-index-site (index-site download-site))
;; For versions 5.92 and later, redirect "installers/<version>"
;; and "docs/<version>/..." to "releases/<version>/..."
(for ([r (in-list all-releases)])
@ -19,3 +22,29 @@
(symlink #:site download-site
(format "../../releases/~a/pdf-doc" v)
(format "docs/~a/pdf" v))))
;; We generally expect "index.html" files to be in place in "releases"
;; and for pre-v6.0 "docs", but keep "installers", "docs", and
;; "releases" directory lists up-to-date as we add new versions:
(for ([r (in-list all-releases)])
(define v (release-version r))
(index-page download-index-site
(format "docs/~a" v)
'(("html" . dir)
("pdf" . dir))))
(void
(index-page download-index-site
"installers"
(for/list ([r (in-list all-releases)])
(cons (release-version r) 'dir))))
(void
(index-page download-index-site
"docs"
(for/list ([r (in-list all-releases)])
(cons (release-version r) 'dir))))
(void
(index-page download-index-site
"releases"
(for/list ([r (in-list all-releases)]
#:when (version<=? "5.92" (release-version r)))
(cons (release-version r) 'dir))))

View File

@ -13,9 +13,10 @@
(register-identity pre-site)
(define (main id)
(define (main path)
@page[#:site pre-site
#:id id
#:file path
#:title "Racket Snapshots"
#:width 'full]{
@columns[10 #:center? #t #:row? #t #:center-text? #f]{
@h3{Snapshot Builds}}
@ -25,7 +26,7 @@
@li{@a[href: "http://plt.eecs.northwestern.edu/snapshots/"]{
Northwestern University}}}}})
;; Generate at both "installers.html" (traditional path)
;; Generate at both "installers/" (traditional path)
;; and "index.html" (old entry point, now subsumed)
(define installers (main 'installers))
(void (main 'index))
(define installers (main "installers/index.html"))
(void (main "index.html"))

View File

@ -0,0 +1,48 @@
#lang racket/load
;; This script uses the "s3-sync" package, even though the enclosing
;; package does not depend on it, and this module is written with
;; `racket/load` to avoid the dependency.
(require s3-sync)
(define (step . s)
(displayln (make-string 72 #\=))
(for-each displayln s)
(displayln (make-string 72 #\-)))
(define orig-dir (current-directory))
(define tmp-dir (make-temporary-file "sync~a" 'directory))
(current-directory tmp-dir)
;; ----------------------------------------
(step "Generate web pages")
(parameterize ([current-namespace (make-base-namespace)]
[current-command-line-arguments (vector "-w"
"-o" "generated"
"-f")])
(dynamic-require 'meta/new-web/all #f)
(dynamic-require '(submod meta/new-web/all main) #f))
(define (upload dir site)
(step (format "Uploading ~a" site))
(s3-sync (build-path "generated" dir)
site
#f
#:upload? #t
#:reduced-redundancy? #t
#:acl "public-read"
#:link-mode 'redirect
#:log displayln))
(upload "www" "racket-lang.org")
(upload "www" "www.racket-lang.org")
(upload "pre" "pre.racket-lang.org")
(upload "con" "con.racket-lang.org")
(upload "drracket" "www.drracket.org")
(upload "download" "download.racket-lang.org")
;; ----------------------------------------
(current-directory orig-dir)
(delete-directory/files tmp-dir)

View File

@ -7,7 +7,7 @@
(define www-site
(site "www"
#:url (rewrite-for-testing "http://www.racket-lang.org/")
#:url (rewrite-for-testing "http://racket-lang.org/")
#:page-headers (identity-headers)
#:navigation
(list