/
pugo.go
58 lines (50 loc) · 1.31 KB
/
pugo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"github.com/codegangsta/cli"
"github.com/go-xiaohei/pugo-static/builder"
"github.com/go-xiaohei/pugo-static/command"
"gopkg.in/inconshreveable/log15.v2"
"gopkg.in/inconshreveable/log15.v2/ext"
)
//go:generate go-bindata -o=asset/asset.go -pkg=asset source/... template/...
const (
VERSION = "0.7.5"
VER_DATE = "2015-11-20"
SRC_DIR = "source" // source contents dir
TPL_DIR = "template" // template dir
UPLOAD_DIR = "upload" // upload dir
DST_DIR = "dest" // destination dir
)
var (
app = cli.NewApp()
opt = new(builder.BuildOption)
)
func init() {
app.Name = "pugo"
app.Usage = "a beautiful site generator"
app.Author = "https://github.com/fuxiaohei"
app.Email = "fuxiaohei@vip.qq.com"
app.Version = VERSION + "(" + VER_DATE + ")"
opt.SrcDir = SRC_DIR
opt.TplDir = TPL_DIR
opt.UploadDir = UPLOAD_DIR
opt.Version = VERSION
opt.VerDate = VER_DATE
log15.Root().SetHandler(log15.LvlFilterHandler(log15.LvlInfo, ext.FatalHandler(log15.StderrHandler)))
}
func main() {
opt := &builder.BuildOption{
SrcDir: SRC_DIR,
TplDir: TPL_DIR,
UploadDir: UPLOAD_DIR,
Version: VERSION,
VerDate: VER_DATE,
}
// app.Action = action
app.Commands = []cli.Command{
command.New(SRC_DIR, TPL_DIR),
command.Build(opt),
command.Server(opt),
}
app.RunAndExitOnError()
}