diff --git a/base/nfs/trash.go b/base/nfs/trash.go index 2e4aa8a0..4e68511c 100644 --- a/base/nfs/trash.go +++ b/base/nfs/trash.go @@ -14,10 +14,10 @@ func _trash_create(m *ice.Message, from string) { return } s, e := StatFile(m, from) - defer Remove(m, from) if m.WarnNotFound(e, from) { return } + defer Remove(m, from) p := path.Join(ice.VAR_TRASH, path.Base(from)) kit.If(!s.IsDir(), func() { Open(m, from, func(r io.Reader) { p = path.Join(ice.VAR_TRASH, kit.HashsPath(r)) }) }) RemoveAll(m, p) diff --git a/base/web/space.go b/base/web/space.go index 0d8c9d01..f0eeb134 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -312,17 +312,15 @@ func init() { }}, mdb.ICONS: {Hand: func(m *ice.Message, arg ...string) { cli.NodeInfo(m, ice.Info.Pathname, WORKER, arg[0]) - mdb.Config(m, mdb.ICONS, arg[0]) m.Cmd(SERVE, m.ActionKey(), arg) }}, - ice.MAIN: {Name: "main index", Help: "首页", Hand: func(m *ice.Message, arg ...string) { + ice.MAIN: {Name: "main index", Hand: func(m *ice.Message, arg ...string) { if len(arg) > 0 { - mdb.Config(m, ice.MAIN, m.Option(ctx.INDEX)) + ice.Info.NodeMain = m.Option(ctx.INDEX) m.Cmd(SERVE, m.ActionKey(), arg) return } - kit.If(mdb.Config(m, ice.MAIN), func(cmd string) { RenderPodCmd(m, "", cmd) }, func() { RenderMain(m) }) - m.Optionv(ice.MSG_ARGS, kit.Simple(m.Optionv(ice.MSG_ARGS))) + kit.If(ice.Info.NodeMain, func(cmd string) { RenderPodCmd(m, "", cmd) }, func() { RenderMain(m) }) }}, ice.INFO: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) { m.Push(mdb.TIME, ice.Info.Make.Time) diff --git a/conf.go b/conf.go index b822c859..534215ec 100644 --- a/conf.go +++ b/conf.go @@ -181,6 +181,8 @@ const ( // DIR LICENSE = "LICENSE" GO_MOD = "go.mod" GO_SUM = "go.sum" + GO_WORK = "go.work" + GO_WORK_SUM = "go.work.sum" ICE_BIN = "ice.bin" CAN_PLUGIN = "can._plugin" ) diff --git a/core/code/autogen.go b/core/code/autogen.go index f4f752a2..a36f6527 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -178,8 +178,15 @@ func init() { _autogen_script(m, p) } }}, - DEVPACK: {Help: "开发", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(WEBPACK, mdb.REMOVE) }}, - WEBPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(WEBPACK, mdb.CREATE) }}, + DEVPACK: {Help: "开发", Hand: func(m *ice.Message, arg ...string) { + m.Cmdy(WEBPACK, mdb.REMOVE) + m.Cmd(web.DREAM, nfs.GOWORK) + }}, + WEBPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { + m.Cmdy(WEBPACK, mdb.CREATE) + nfs.Trash(m, ice.GO_WORK_SUM) + nfs.Trash(m, ice.GO_WORK) + }}, BINPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { const ( USR_RELEASE_CONF_GO = "usr/release/conf.go" diff --git a/info.go b/info.go index cfead0a6..89761553 100644 --- a/info.go +++ b/info.go @@ -63,6 +63,7 @@ type info struct { NodeName string NodeType string NodeIcon string + NodeMain string Pwd string Lang string diff --git a/misc/git/repos.go b/misc/git/repos.go index 2fb70e67..1c14cf63 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -227,7 +227,7 @@ func _repos_status(m *ice.Message, p string, repos *git.Repository) error { if err != nil { return err } - ignore := []string{} + ignore := []string{ice.GO_WORK, ice.GO_WORK_SUM} nfs.Exists(m, path.Join(_repos_path(m, p), ".gitignore"), func(p string) { ignore = kit.Split(m.Cmdx(nfs.CAT, p), lex.NL) }) for k, v := range status { if kit.HasPrefix(k, nfs.PT) || (kit.HasPrefix(k, ignore...) && !strings.HasPrefix(k, ice.USR_LOCAL_EXPORT)) {