enable targeting another site dir

This commit is contained in:
Mark McGranaghan 2012-10-09 13:20:02 -07:00
parent 367cf27324
commit 2972869e0b
2 changed files with 20 additions and 2 deletions

View File

@ -1,7 +1,7 @@
## Go by Example ## Go by Example
Source for the [Go by Example](https://gobyexample.com) Content and toolchain source for the
site. [Go by Example](https://gobyexample.com) site.
### Overview ### Overview
@ -39,6 +39,16 @@ Generation requires the [`pygmentize`](http://pygments.org/)
binary for syntax highlighting. 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 ### License
This work is licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/). This work is licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/).

View File

@ -101,6 +101,13 @@ func whichLexer(path string) string {
return "" return ""
} }
func whichSiteDir() {
dir := os.Getenv("SITEDIR")
if dir != "" {
siteDir = dir
}
}
func debug(msg string) { func debug(msg string) {
if os.Getenv("DEBUG") == "1" { if os.Getenv("DEBUG") == "1" {
fmt.Fprintln(os.Stderr, msg) fmt.Fprintln(os.Stderr, msg)
@ -228,6 +235,7 @@ func renderChapters(chapters []*Chapter) {
} }
func main() { func main() {
whichSiteDir()
ensureDir(siteDir) ensureDir(siteDir)
copyFile("template/site.css", siteDir+"/site.css") copyFile("template/site.css", siteDir+"/site.css")
chapters := parseChapters() chapters := parseChapters()