1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 12:07:00 +08:00
This commit is contained in:
harveyshao 2022-04-22 19:11:28 +08:00
parent fc55214a38
commit 3c40de3c1c
7 changed files with 125 additions and 94 deletions

View File

@ -204,6 +204,13 @@ func init() {
}
m.Sort(nfs.PATH)
}},
"make.domain": {Name: "make.domain", Help: "接口命令", Hand: func(m *ice.Message, arg ...string) {
if os.Getenv("ctx_dev") == "" || os.Getenv("ctx_pod") == "" {
m.Echo(m.Conf(RUNTIME, "make.domain"))
} else {
m.Echo(kit.MergePOD(os.Getenv("ctx_dev"), os.Getenv("ctx_pod")))
}
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) > 0 && arg[0] == BOOTINFO {
arg = arg[1:]

View File

@ -92,7 +92,7 @@ func _space_handle(m *ice.Message, safe bool, send map[string]*ice.Message, c *w
msg.Log("recv", "%v->%v %s %v", source, target, msg.Detailv(), msg.FormatMeta())
if len(target) == 0 {
msg.Log_AUTH(aaa.USERROLE, msg.Option(ice.MSG_USERROLE), aaa.USERNAME, msg.Option(ice.MSG_USERNAME))
msg.Log_AUTH(aaa.USERROLE, kit.Select(msg.Option(ice.MSG_USERROLE), m.Cmd(aaa.USER, msg.Option(ice.MSG_USERNAME)).Append(aaa.USERROLE)), aaa.USERNAME, msg.Option(ice.MSG_USERNAME))
if msg.Optionv(ice.MSG_HANDLE, ice.TRUE); safe { // 下行命令
msg.Go(func() { _space_exec(msg, source, target, c, name) })
} else { // 上行请求

View File

@ -8,6 +8,8 @@ import (
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/ssh"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/core/code"
@ -123,6 +125,15 @@ func init() {
_header_users(m, m.ActionKey(), arg...)
}},
"local": {Name: "local", Help: "配置", Hand: func(m *ice.Message, arg ...string) {
pod := strings.Split(m.Cmdx(web.SPACE, m.Option(ice.MSG_USERPOD), cli.RUNTIME, "make.domain"), "/chat/pod/")[1]
m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), nfs.SAVE, "etc/local.shy", m.Cmdx(web.SPACE, pod, nfs.CAT, "etc/local.shy"))
m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), ssh.SOURCE, "etc/local.shy")
}},
aaa.INVITE: {Name: "invite", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.CORE)
m.Cmd(code.PUBLISH, mdb.CREATE, nfs.FILE, ice.BIN_ICE_BIN)
}},
code.WEBPACK: {Name: "webpack", Help: "打包页面", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(code.WEBPACK, cli.BUILD, m.OptionSimple(mdb.NAME))
}},

View File

@ -115,6 +115,7 @@ func _autogen_git(m *ice.Message, arg ...string) map[string]interface{} {
"Remote", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "config", "remote.origin.url")),
"Branch", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "rev-parse", "--abbrev-ref", "HEAD")),
"Version", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "describe", "--tags")),
"Domain", m.Option(ice.MSG_USERWEB),
)
}
func _autogen_gits(m *ice.Message, arg ...string) string {
@ -199,6 +200,7 @@ func init() {
m.Cmdy(nfs.DIR, "usr/release/binpack.go")
m.Cmdy(nfs.DIR, "usr/release/conf.go")
}
m.Cmdy(nfs.CAT, "src/version.go")
}},
RELAY: {Name: "relay alias username host port list", Help: "跳板", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(COMPILE, RELAY)

View File

@ -75,7 +75,11 @@ func _binpack_ctx(m *ice.Message, f *os.File) {
const BINPACK = "binpack"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
Index.Merge(&ice.Context{
Configs: map[string]*ice.Config{
BINPACK: {Name: "binpack", Help: "打包", Value: kit.Data(mdb.SHORT, "path", mdb.FIELD, "time,path")},
},
Commands: map[string]*ice.Command{
BINPACK: {Name: "binpack path auto create remove export", Help: "打包", Action: map[string]*ice.Action{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
if kit.FileExists(path.Join(ice.USR_VOLCANOS, ice.PROTO_JS)) {
@ -148,6 +152,9 @@ func init() {
fmt.Fprintln(f, ` pack := map[string][]byte{`)
_binpack_ctx(m, f)
m.Cmd(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields(nfs.PATH)).Table(func(index int, value map[string]string, head []string) {
_binpack_dir(m, f, value[nfs.PATH])
})
fmt.Fprintln(f, _binpack_file(m, ice.ETC_INIT_SHY))
fmt.Fprintln(f, _binpack_file(m, ice.ETC_EXIT_SHY))
fmt.Fprintln(f, ` }`)
@ -158,6 +165,9 @@ func init() {
`)
}
}},
mdb.INSERT: {Name: "insert", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(mdb.INSERT, m.PrefixKey(), "", mdb.HASH, nfs.PATH, arg[0])
}},
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
ice.Info.Pack = map[string][]byte{}
}},

View File

@ -15,6 +15,7 @@ type MakeInfo struct {
Module string
Remote string
Branch string
Domain string
Version string
HostName string
UserName string

View File

@ -64,11 +64,11 @@ func init() {
m.Option(mdb.NAME, kit.Select(strings.TrimSuffix(path.Base(m.Option(REPOS)), ".git"), m.Option(mdb.NAME)))
m.Option(nfs.PATH, kit.Select(path.Join(ice.USR, m.Option(mdb.NAME)), m.Option(nfs.PATH)))
m.Option(REPOS, kit.Select(m.Config(REPOS)+ice.PS+m.Option(mdb.NAME), m.Option(REPOS)))
if strings.Contains(m.Option(REPOS), "@") {
ls := strings.Split(m.Option(REPOS), "@")
m.Option(REPOS, ls[0])
m.Option(BRANCH, ls[1])
}
// if strings.Contains(m.Option(REPOS), "@") {
// ls := strings.Split(m.Option(REPOS), "@")
// m.Option(REPOS, ls[0])
// m.Option(BRANCH, ls[1])
// }
_repos_insert(m, m.Option(mdb.NAME), m.Option(nfs.PATH))
if s, e := os.Stat(path.Join(m.Option(nfs.PATH), ".git")); e == nil && s.IsDir() {