Merge branch 'buildtestchanges'
This commit is contained in:
commit
ff7d5ba117
@ -15,4 +15,4 @@ script:
|
|||||||
- tools/build
|
- tools/build
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- VERBOSE=1
|
- VERBOSE=1 TESTING=1
|
||||||
|
26
tools/build
26
tools/build
@ -15,5 +15,27 @@ tools/format
|
|||||||
verbose && echo "Measuring line lengths..."
|
verbose && echo "Measuring line lengths..."
|
||||||
tools/measure
|
tools/measure
|
||||||
|
|
||||||
verbose && echo "Generating HTML..."
|
# SITE_DIR is the final location where we want generated content to be
|
||||||
tools/generate
|
SITE_DIR="public"
|
||||||
|
|
||||||
|
# GENERATE_DIR is where the content will be generated initially
|
||||||
|
GENERATE_DIR="$(mktemp -d)"
|
||||||
|
|
||||||
|
function cleanup() {
|
||||||
|
rm -rf "$GENERATE_DIR"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
verbose && echo "Generating HTML to $GENERATE_DIR..."
|
||||||
|
tools/generate $GENERATE_DIR
|
||||||
|
|
||||||
|
# In TESTING mode, make sure that the generated content is identical to
|
||||||
|
# what's already in SITE_DIR. If a difference is found, this script exits
|
||||||
|
# with an error.
|
||||||
|
if [[ ! -z "$TESTING" ]]; then
|
||||||
|
echo "Comparing $GENERATE_DIR with $SITE_DIR..."
|
||||||
|
diff -r "$GENERATE_DIR" "$SITE_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
verbose && echo "Copying $GENERATE_DIR to $SITE_DIR"
|
||||||
|
cp -rf "${GENERATE_DIR}/." "$SITE_DIR"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
exec go run tools/generate.go
|
exec go run tools/generate.go $@
|
||||||
|
@ -15,8 +15,12 @@ import (
|
|||||||
"github.com/russross/blackfriday"
|
"github.com/russross/blackfriday"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cacheDir = "/tmp/gobyexample-cache"
|
// siteDir is the target directory into which the HTML gets generated. Its
|
||||||
|
// default is set here but can be changed by an argument passed into the
|
||||||
|
// program.
|
||||||
var siteDir = "./public"
|
var siteDir = "./public"
|
||||||
|
|
||||||
|
var cacheDir = "/tmp/gobyexample-cache"
|
||||||
var pygmentizeBin = "./vendor/pygments/pygmentize"
|
var pygmentizeBin = "./vendor/pygments/pygmentize"
|
||||||
|
|
||||||
func verbose() bool {
|
func verbose() bool {
|
||||||
@ -301,6 +305,11 @@ func renderExamples(examples []*Example) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if len(os.Args) > 1 {
|
||||||
|
siteDir = os.Args[1]
|
||||||
|
}
|
||||||
|
ensureDir(siteDir)
|
||||||
|
|
||||||
copyFile("templates/site.css", siteDir+"/site.css")
|
copyFile("templates/site.css", siteDir+"/site.css")
|
||||||
copyFile("templates/favicon.ico", siteDir+"/favicon.ico")
|
copyFile("templates/favicon.ico", siteDir+"/favicon.ico")
|
||||||
copyFile("templates/404.html", siteDir+"/404.html")
|
copyFile("templates/404.html", siteDir+"/404.html")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user