Skip to content
This repository has been archived by the owner on May 8, 2022. It is now read-only.

Commit

Permalink
fix 'new' command bug after directory changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxiaohei committed Oct 24, 2016
1 parent fe81b4f commit 47af34f
Show file tree
Hide file tree
Showing 6 changed files with 678 additions and 566 deletions.
1,223 changes: 669 additions & 554 deletions app/asset/asset.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion app/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func After(fn Handler) {
func Build(ctx *Context) {
b.IsBuilding = true
t := time.Now()
log15.Info("Build|Start")
for i, h := range b.handlers {
if h(ctx); ctx.Err != nil {
log15.Crit("Build|Fail|%s", ctx.Err.Error())
Expand Down
1 change: 1 addition & 0 deletions app/builder/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func Compile(ctx *Context) {
}
worker.WaitStop()
ctx.Err = compileXML(ctx)
log15.Info("Compile|Done")
}

func compilePosts2(ctx *Context) []*helper.GoWorkerRequest {
Expand Down
2 changes: 2 additions & 0 deletions app/builder/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func ReadPosts(ctx *Context) ([]*model.Post, error) {
if !com.IsDir(srcDir) {
return nil, fmt.Errorf("posts directory '%s' is missing", srcDir)
}
log15.Info("Read|Posts|%s", srcDir)

// try load post.toml or post.ini to read total meta file
var (
Expand Down Expand Up @@ -214,6 +215,7 @@ func ReadPages(ctx *Context) ([]*model.Page, error) {
if !com.IsDir(srcDir) {
return nil, fmt.Errorf("pages directory '%s' is missing", srcDir)
}
log15.Info("Read|Pages|%s", srcDir)

var (
err error
Expand Down
15 changes: 5 additions & 10 deletions app/command/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,16 @@ func newPage(args []string, dstDir string) error {

func newSite(onlyDoc bool) error {
log15.Info("New|Extract|Assets")
dirs := []string{"source", "theme", "doc"}
dirs := []string{"source"}
if onlyDoc {
dirs = []string{"doc"}
}
isSuccess := true

var (
err error
isExtract = true
err error
)
for _, dir := range dirs {
isExtract = (dir != "doc")
if onlyDoc {
isExtract = (dir == "doc")
}
if !isExtract {
continue
}
log15.Info("New|Extract|Directory|%s", dir)
if err = asset.RestoreAssets("./", dir); err != nil {
isSuccess = false
Expand Down
2 changes: 1 addition & 1 deletion pugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/urfave/cli"
)

//go:generate go-bindata -o=app/asset/asset.go -pkg=asset source/... theme/... doc/source/... doc/theme/...
//go:generate go-bindata -o=app/asset/asset.go -pkg=asset source/... doc/source/... doc/theme/...
//go:generate gofmt -w -s .

func main() {
Expand Down

0 comments on commit 47af34f

Please sign in to comment.