From 2972869e0b9def94c3a29e8b6dced119bbd5e5b3 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Tue, 9 Oct 2012 13:20:02 -0700 Subject: [PATCH] enable targeting another site dir --- README.md | 14 ++++++++++++-- tool/generate.go | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d86093..798e78f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Go by Example -Source for the [Go by Example](https://gobyexample.com) -site. +Content and toolchain source for the +[Go by Example](https://gobyexample.com) site. ### Overview @@ -39,6 +39,16 @@ Generation requires the [`pygmentize`](http://pygments.org/) binary for syntax highlighting. +### Serving + +The site is served by the [gobyexample-server](https://github.com/mmcgrana/gobyexample-server) +tool. To export to this tool: + +```console +$ SITEDIR = ../gobyexample-server/public tool/build +``` + + ### License This work is licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/). diff --git a/tool/generate.go b/tool/generate.go index babf717..3a6405b 100644 --- a/tool/generate.go +++ b/tool/generate.go @@ -101,6 +101,13 @@ func whichLexer(path string) string { return "" } +func whichSiteDir() { + dir := os.Getenv("SITEDIR") + if dir != "" { + siteDir = dir + } +} + func debug(msg string) { if os.Getenv("DEBUG") == "1" { fmt.Fprintln(os.Stderr, msg) @@ -228,6 +235,7 @@ func renderChapters(chapters []*Chapter) { } func main() { + whichSiteDir() ensureDir(siteDir) copyFile("template/site.css", siteDir+"/site.css") chapters := parseChapters()