forked from x/icebergs
opt some
This commit is contained in:
parent
304600f586
commit
b431cf237f
@ -1,10 +1,14 @@
|
|||||||
package chat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
"shylinux.com/x/icebergs/core/code"
|
"shylinux.com/x/icebergs/core/code"
|
||||||
@ -112,6 +116,11 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
"unpack": {Name: "unpack", Help: "开发模式", Hand: func(m *ice.Message, arg ...string) {
|
"unpack": {Name: "unpack", Help: "开发模式", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(code.WEBPACK, "unpack")
|
m.Cmdy(code.WEBPACK, "unpack")
|
||||||
|
|
||||||
|
p := path.Join("src/debug", ice.GO_MOD)
|
||||||
|
if _, e := os.Stat(p); e == nil {
|
||||||
|
m.Cmd(nfs.COPY, ice.GO_MOD, p)
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Option(TRANS, kit.Format(kit.Value(c.Commands[cmd].Meta, "_trans")))
|
m.Option(TRANS, kit.Format(kit.Value(c.Commands[cmd].Meta, "_trans")))
|
||||||
|
@ -51,6 +51,10 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(AUTOGEN, BINPACK)
|
m.Cmdy(AUTOGEN, BINPACK)
|
||||||
|
p := path.Join("src/release", ice.GO_MOD)
|
||||||
|
if _, e := os.Stat(p); e == nil {
|
||||||
|
m.Cmd(nfs.COPY, ice.GO_MOD, p)
|
||||||
|
}
|
||||||
m.ProcessInner()
|
m.ProcessInner()
|
||||||
}},
|
}},
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -131,20 +131,18 @@ func init() {
|
|||||||
m.Cmdy(cli.SYSTEM, MAKE)
|
m.Cmdy(cli.SYSTEM, MAKE)
|
||||||
}},
|
}},
|
||||||
TAGS: {Name: "tags", Help: "标签", Hand: func(m *ice.Message, arg ...string) {
|
TAGS: {Name: "tags", Help: "标签", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ProcessHold()
|
|
||||||
vs := map[string]string{}
|
vs := map[string]string{}
|
||||||
m.Cmd(STATUS).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(STATUS).Table(func(index int, value map[string]string, head []string) {
|
||||||
if value["type"] == "##" {
|
if value[kit.MDB_TYPE] == "##" {
|
||||||
if value["name"] == "release" {
|
if value[kit.MDB_NAME] == "release" {
|
||||||
value["name"] = "ice"
|
value[kit.MDB_NAME] = "ice"
|
||||||
}
|
}
|
||||||
|
|
||||||
vs[value["name"]] = strings.Split(value["tags"], "-")[0]
|
vs[value[kit.MDB_NAME]] = strings.Split(value[TAGS], "-")[0]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
m.Option(nfs.CAT_LOCAL, ice.TRUE)
|
m.ProcessHold()
|
||||||
|
|
||||||
m.GoToast(TAGS, func(toast func(string, int, int)) {
|
m.GoToast(TAGS, func(toast func(string, int, int)) {
|
||||||
count, total := 0, len(vs)
|
count, total := 0, len(vs)
|
||||||
toast(cli.BEGIN, count, total)
|
toast(cli.BEGIN, count, total)
|
||||||
@ -158,30 +156,34 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
change := false
|
change := false
|
||||||
|
m.Option(nfs.CAT_LOCAL, ice.TRUE)
|
||||||
m.Option(nfs.DIR_ROOT, _repos_path(k))
|
m.Option(nfs.DIR_ROOT, _repos_path(k))
|
||||||
mod := m.Cmdx(nfs.CAT, ice.GO_MOD, func(text string, line int) string {
|
mod := m.Cmdx(nfs.CAT, ice.GO_MOD, func(text string, line int) string {
|
||||||
ls := kit.Split(text)
|
ls := kit.Split(strings.TrimPrefix(text, "require"))
|
||||||
if len(ls) < 2 || ls[1] == "=>" || !strings.Contains(ls[0], "/") {
|
if len(ls) < 2 || !strings.Contains(ls[0], "/") || !strings.Contains(ls[1], ".") {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
if v, ok := vs[kit.Slice(strings.Split(ls[0], "/"), -1)[0]]; ok && ls[1] != v {
|
if v, ok := vs[kit.Slice(strings.Split(ls[0], "/"), -1)[0]]; ok && ls[1] != v {
|
||||||
|
m.Debug("upgrade to %v %v from %v", ls[0], ls[1], v)
|
||||||
text = ice.TB + ls[0] + ice.SP + v
|
text = ice.TB + ls[0] + ice.SP + v
|
||||||
change = true
|
change = true
|
||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
})
|
})
|
||||||
|
|
||||||
if change {
|
if !change || mod == "" {
|
||||||
m.Cmd(nfs.SAVE, ice.GO_SUM, "")
|
continue
|
||||||
m.Cmd(nfs.SAVE, ice.GO_MOD, mod)
|
}
|
||||||
m.Option(cli.CMD_DIR, _repos_path(k))
|
|
||||||
if k == ice.CONTEXTS {
|
m.Cmd(nfs.SAVE, ice.GO_SUM, "")
|
||||||
continue
|
m.Cmd(nfs.SAVE, ice.GO_MOD, mod)
|
||||||
}
|
m.Option(cli.CMD_DIR, _repos_path(k))
|
||||||
if k == ice.ICEBERGS {
|
|
||||||
m.Cmd(cli.SYSTEM, "go", "build")
|
switch k {
|
||||||
continue
|
case ice.CONTEXTS:
|
||||||
}
|
case ice.ICEBERGS:
|
||||||
|
m.Cmd(cli.SYSTEM, "go", "build")
|
||||||
|
default:
|
||||||
m.Cmd(cli.SYSTEM, cli.MAKE)
|
m.Cmd(cli.SYSTEM, cli.MAKE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user