Browse Source

Add res section in gopmfile

pull/103/head
Unknown 11 years ago
parent
commit
dd724eb8be
  1. 13
      cmd/gen.go
  2. 2
      gopm.go

13
cmd/gen.go

@ -41,6 +41,8 @@ Make sure you run this command in the root path of a go project.`,
}, },
} }
var commonRes = []string{"views", "templates", "static", "public", "conf"}
func runGen(ctx *cli.Context) { func runGen(ctx *cli.Context) {
setup(ctx) setup(ctx)
@ -55,7 +57,7 @@ func runGen(ctx *cli.Context) {
} }
targetPath := parseTarget(gf.MustValue("target", "path")) targetPath := parseTarget(gf.MustValue("target", "path"))
// Get dependencies. // Get and set dependencies.
imports := doc.GetAllImports([]string{workDir}, targetPath, ctx.Bool("example")) imports := doc.GetAllImports([]string{workDir}, targetPath, ctx.Bool("example"))
log.Log("%v", imports) log.Log("%v", imports)
for _, p := range imports { for _, p := range imports {
@ -71,6 +73,15 @@ func runGen(ctx *cli.Context) {
} }
} }
// Get and set resources.
res := make([]string, 0, len(commonRes))
for _, cr := range commonRes {
if com.IsExist(cr) {
res = append(res, cr)
}
}
gf.SetValue("res", "include", strings.Join(res, "|"))
err = goconfig.SaveConfigFile(gf, ".gopmfile") err = goconfig.SaveConfigFile(gf, ".gopmfile")
if err != nil { if err != nil {
log.Error("gen", "Fail to save gopmfile:") log.Error("gen", "Fail to save gopmfile:")

2
gopm.go

@ -29,7 +29,7 @@ import (
// Test that go1.1 tag above is included in builds. main.go refers to this definition. // Test that go1.1 tag above is included in builds. main.go refers to this definition.
const go11tag = true const go11tag = true
const APP_VER = "0.6.3.0311" const APP_VER = "0.6.3.0312"
// //cmd.CmdSearch, // //cmd.CmdSearch,
// cmdClean, // cmdClean,

Loading…
Cancel
Save