When testing on Travis, verify that tools/build was run

This is done by routing the generation of HTML into a temporary directory,
and checking its diff agains the existing public/ when running tests.

Fixes #237
This commit is contained in:
Eli Bendersky
2019-07-01 06:44:09 -07:00
parent 3d55c3ae33
commit fb2c28e58a
4 changed files with 36 additions and 4 deletions

View File

@@ -15,8 +15,12 @@ import (
"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 cacheDir = "/tmp/gobyexample-cache"
var pygmentizeBin = "./vendor/pygments/pygmentize"
func verbose() bool {
@@ -301,6 +305,11 @@ func renderExamples(examples []*Example) {
}
func main() {
if len(os.Args) > 1 {
siteDir = os.Args[1]
}
ensureDir(siteDir)
copyFile("templates/site.css", siteDir+"/site.css")
copyFile("templates/favicon.ico", siteDir+"/favicon.ico")
copyFile("templates/404.html", siteDir+"/404.html")