explicitly which and check pygmentize bin. ref #15
This commit is contained in:
parent
4d9a8a231e
commit
8116d5abe3
@ -14,7 +14,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var cacheDir = "/tmp/gobyexample-cache"
|
var cacheDir = "/tmp/gobyexample-cache"
|
||||||
var siteDir = "site"
|
var siteDir = ""
|
||||||
|
var pygmentizeBin = ""
|
||||||
|
|
||||||
func check(err error) {
|
func check(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -110,9 +111,17 @@ func whichSiteDir() {
|
|||||||
dir := os.Getenv("SITEDIR")
|
dir := os.Getenv("SITEDIR")
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
siteDir = dir
|
siteDir = dir
|
||||||
|
} else {
|
||||||
|
siteDir = "site"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func whichPygmentize() {
|
||||||
|
bin, err := exec.LookPath("pygmentize")
|
||||||
|
check(err)
|
||||||
|
pygmentizeBin = bin
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
@ -245,6 +254,7 @@ func renderExamples(examples []*Example) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
whichSiteDir()
|
whichSiteDir()
|
||||||
|
whichPygmentize()
|
||||||
ensureDir(siteDir)
|
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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user