mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt some
This commit is contained in:
parent
47ea2e37a5
commit
e4d49f4c1f
@ -46,6 +46,7 @@ func init() {
|
|||||||
IsAlpine(m, "node", "system apk add nodejs")
|
IsAlpine(m, "node", "system apk add nodejs")
|
||||||
IsAlpine(m, "java", "system apk add openjdk8")
|
IsAlpine(m, "java", "system apk add openjdk8")
|
||||||
IsAlpine(m, "javac", "system apk add openjdk8")
|
IsAlpine(m, "javac", "system apk add openjdk8")
|
||||||
|
IsAlpine(m, "mvn", "system apk add openjdk8 maven")
|
||||||
IsAlpine(m, "python", "system apk add python2")
|
IsAlpine(m, "python", "system apk add python2")
|
||||||
IsAlpine(m, "python2", "system apk add python2")
|
IsAlpine(m, "python2", "system apk add python2")
|
||||||
IsAlpine(m, "python3", "system apk add python3")
|
IsAlpine(m, "python3", "system apk add python3")
|
||||||
|
@ -34,6 +34,9 @@ func _config_save(m *ice.Message, name string, arg ...string) {
|
|||||||
for _, k := range arg {
|
for _, k := range arg {
|
||||||
if v := msg.Confv(k); v != "" {
|
if v := msg.Confv(k); v != "" {
|
||||||
data[k] = v
|
data[k] = v
|
||||||
|
if k == "web.code.trpc.oauth" {
|
||||||
|
m.Debug("wha5 %v %v", k, v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +46,9 @@ func _config_save(m *ice.Message, name string, arg ...string) {
|
|||||||
m.Log_EXPORT(CONFIG, name, nfs.FILE, p, nfs.SIZE, n)
|
m.Log_EXPORT(CONFIG, name, nfs.FILE, p, nfs.SIZE, n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if name == "var/conf/web.code.trpc.json" {
|
||||||
|
m.Debug("wha5 %v %v %v", name, p, data)
|
||||||
|
}
|
||||||
m.Echo(p)
|
m.Echo(p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ func _dream_list(m *ice.Message) *ice.Message {
|
|||||||
if m.Richs(SPACE, nil, value[mdb.NAME], func(key string, val map[string]interface{}) {
|
if m.Richs(SPACE, nil, value[mdb.NAME], func(key string, val map[string]interface{}) {
|
||||||
m.Push(mdb.TYPE, val[mdb.TYPE])
|
m.Push(mdb.TYPE, val[mdb.TYPE])
|
||||||
m.Push(cli.STATUS, cli.START)
|
m.Push(cli.STATUS, cli.START)
|
||||||
m.PushButton("edit", "open", cli.STOP)
|
m.PushButton("vimer", cli.OPEN, cli.STOP)
|
||||||
m.PushAnchor(strings.Split(m.MergePod(value[mdb.NAME]), "?")[0])
|
m.PushAnchor(strings.Split(m.MergePod(value[mdb.NAME]), "?")[0])
|
||||||
}) == nil {
|
}) == nil {
|
||||||
m.Push(mdb.TYPE, WORKER)
|
m.Push(mdb.TYPE, WORKER)
|
||||||
@ -111,13 +111,13 @@ func init() {
|
|||||||
_dream_list(m).Cut("name,status,time")
|
_dream_list(m).Cut("name,status,time")
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
cli.START: {Name: "start name=hi repos river", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
cli.START: {Name: "start name=hi repos", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_dream_show(m, m.Option(mdb.NAME, kit.Select(path.Base(m.Option(nfs.REPOS)), m.Option(mdb.NAME))))
|
_dream_show(m, m.Option(mdb.NAME, kit.Select(path.Base(m.Option(nfs.REPOS)), m.Option(mdb.NAME))))
|
||||||
}},
|
}},
|
||||||
"open": {Name: "open", Help: "打开", Hand: func(m *ice.Message, arg ...string) {
|
cli.OPEN: {Name: "open", Help: "打开", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ProcessOpen(m.MergePod(m.Option(mdb.NAME), "", ""))
|
m.ProcessOpen(m.MergePod(m.Option(mdb.NAME), "", ""))
|
||||||
}},
|
}},
|
||||||
"edit": {Name: "edit", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
"vimer": {Name: "vimer", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ProcessOpen(m.MergePod(m.Option(mdb.NAME)+"/cmd/web.code.vimer", "", ""))
|
m.ProcessOpen(m.MergePod(m.Option(mdb.NAME)+"/cmd/web.code.vimer", "", ""))
|
||||||
}},
|
}},
|
||||||
cli.STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
|
cli.STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -92,6 +92,10 @@ 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())
|
msg.Log("recv", "%v->%v %s %v", source, target, msg.Detailv(), msg.FormatMeta())
|
||||||
|
|
||||||
if len(target) == 0 {
|
if len(target) == 0 {
|
||||||
|
if msg.Option(ice.MSG_HANDLE) == ice.TRUE {
|
||||||
|
msg.Debug("what %v %v", msg.FormatMeta(), msg.FormatStack())
|
||||||
|
continue
|
||||||
|
}
|
||||||
if msg.Optionv(ice.MSG_HANDLE, ice.TRUE); safe { // 下行命令
|
if msg.Optionv(ice.MSG_HANDLE, ice.TRUE); safe { // 下行命令
|
||||||
msg.Option(ice.MSG_USERROLE, kit.Select(msg.Option(ice.MSG_USERROLE), msg.Cmd(aaa.USER, msg.Option(ice.MSG_USERNAME)).Append(aaa.USERROLE)))
|
msg.Option(ice.MSG_USERROLE, kit.Select(msg.Option(ice.MSG_USERROLE), msg.Cmd(aaa.USER, msg.Option(ice.MSG_USERNAME)).Append(aaa.USERROLE)))
|
||||||
if msg.Option(ice.MSG_USERROLE) == aaa.VOID && ice.Info.UserName == "demo" {
|
if msg.Option(ice.MSG_USERROLE) == aaa.VOID && ice.Info.UserName == "demo" {
|
||||||
@ -220,7 +224,7 @@ func _space_search(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
func _space_fork(m *ice.Message) {
|
func _space_fork(m *ice.Message) {
|
||||||
if s, e := websocket.Upgrade(m.W, m.R, nil, kit.Int(m.Config("buffer.r")), kit.Int(m.Config("buffer.w"))); m.Assert(e) {
|
if s, e := websocket.Upgrade(m.W, m.R, nil, kit.Int(m.Config("buffer.r")), kit.Int(m.Config("buffer.w"))); m.Assert(e) {
|
||||||
text := kit.Select(s.RemoteAddr().String(), m.Option(ice.MSG_USERADDR))
|
text := kit.Select(s.RemoteAddr().String(), m.Option(ice.MSG_USERADDR))
|
||||||
name := m.Option(mdb.NAME, kit.ReplaceAll(kit.Select(text, m.Option(mdb.NAME)), ".", "_", ":", "_"))
|
name := strings.ToLower(m.Option(mdb.NAME, kit.ReplaceAll(kit.Select(text, m.Option(mdb.NAME)), ".", "_", ":", "_")))
|
||||||
kind := kit.Select(WORKER, m.Option(mdb.TYPE))
|
kind := kit.Select(WORKER, m.Option(mdb.TYPE))
|
||||||
args := append([]string{mdb.TYPE, kind, mdb.NAME, name}, m.OptionSimple(SHARE, RIVER)...)
|
args := append([]string{mdb.TYPE, kind, mdb.NAME, name}, m.OptionSimple(SHARE, RIVER)...)
|
||||||
|
|
||||||
@ -326,7 +330,7 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 下发命令
|
// 下发命令
|
||||||
_space_send(m, arg[0], arg[1:]...)
|
_space_send(m, strings.ToLower(arg[0]), arg[1:]...)
|
||||||
}},
|
}},
|
||||||
"/space/": {Name: "/space/ type name share river", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"/space/": {Name: "/space/ type name share river", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_space_fork(m)
|
_space_fork(m)
|
||||||
|
@ -94,7 +94,7 @@ func _spide_list(m *ice.Message, arg ...string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Config(LOGHEADERS) == ice.TRUE {
|
if true || m.Config(LOGHEADERS) == ice.TRUE {
|
||||||
for k, v := range res.Header {
|
for k, v := range res.Header {
|
||||||
m.Debug("%v: %v", k, v)
|
m.Debug("%v: %v", k, v)
|
||||||
}
|
}
|
||||||
@ -112,6 +112,8 @@ func _spide_list(m *ice.Message, arg ...string) {
|
|||||||
|
|
||||||
// 错误信息
|
// 错误信息
|
||||||
if m.Warn(res.StatusCode != http.StatusOK, ice.ErrNotFound, uri, "status", res.Status) {
|
if m.Warn(res.StatusCode != http.StatusOK, ice.ErrNotFound, uri, "status", res.Status) {
|
||||||
|
b, _ := ioutil.ReadAll(res.Body)
|
||||||
|
m.Debug("whhat %v", string(b))
|
||||||
switch m.Set(ice.MSG_RESULT); res.StatusCode {
|
switch m.Set(ice.MSG_RESULT); res.StatusCode {
|
||||||
case http.StatusNotFound:
|
case http.StatusNotFound:
|
||||||
m.Warn(true, ice.ErrNotFound, uri)
|
m.Warn(true, ice.ErrNotFound, uri)
|
||||||
@ -225,7 +227,13 @@ func _spide_head(m *ice.Message, req *http.Request, head map[string]string, valu
|
|||||||
req.AddCookie(&http.Cookie{Name: key, Value: value})
|
req.AddCookie(&http.Cookie{Name: key, Value: value})
|
||||||
m.Logs(key, value)
|
m.Logs(key, value)
|
||||||
})
|
})
|
||||||
list := kit.Simple(m.Optionv(SPIDE_HEADER))
|
list := kit.Simple(m.Optionv(SPIDE_COOKIE))
|
||||||
|
for i := 0; i < len(list)-1; i += 2 {
|
||||||
|
req.AddCookie(&http.Cookie{Name: list[i], Value: list[i+1]})
|
||||||
|
m.Logs(list[i], list[i+1])
|
||||||
|
}
|
||||||
|
|
||||||
|
list = kit.Simple(m.Optionv(SPIDE_HEADER))
|
||||||
for i := 0; i < len(list)-1; i += 2 {
|
for i := 0; i < len(list)-1; i += 2 {
|
||||||
req.Header.Set(list[i], list[i+1])
|
req.Header.Set(list[i], list[i+1])
|
||||||
m.Logs(list[i], list[i+1])
|
m.Logs(list[i], list[i+1])
|
||||||
|
@ -50,6 +50,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch p := path.Join(arg...); kit.Ext(p) {
|
switch p := path.Join(arg...); kit.Ext(p) {
|
||||||
|
case nfs.CSS:
|
||||||
|
|
||||||
case nfs.JS:
|
case nfs.JS:
|
||||||
if cmd := ice.GetFileCmd(p); cmd != "" {
|
if cmd := ice.GetFileCmd(p); cmd != "" {
|
||||||
m.Display(ice.FileURI(p))
|
m.Display(ice.FileURI(p))
|
||||||
@ -71,6 +73,9 @@ func init() {
|
|||||||
m.RenderResult()
|
m.RenderResult()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
case "iml":
|
||||||
|
m.RenderRedirect(path.Join(CHAT_WEBSITE, strings.TrimPrefix(p, SRC_WEBSITE)))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.PodCmd(ctx.COMMAND, arg[0]) {
|
if m.PodCmd(ctx.COMMAND, arg[0]) {
|
||||||
|
@ -126,6 +126,11 @@ func init() {
|
|||||||
ctx.CONFIG: {Name: "config scope", Help: "配置", Hand: func(m *ice.Message, arg ...string) {
|
ctx.CONFIG: {Name: "config scope", Help: "配置", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(web.SPACE, m.Option(ice.MSG_USERPOD), m.Prefix(OAUTH), CHECK, arg)
|
m.Cmdy(web.SPACE, m.Option(ice.MSG_USERPOD), m.Prefix(OAUTH), CHECK, arg)
|
||||||
}},
|
}},
|
||||||
|
code.PUBLISH: {Name: "publish", Help: "发布", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if !m.PodCmd(code.PUBLISH, ice.CONTEXTS) {
|
||||||
|
m.Cmdy(code.PUBLISH, ice.CONTEXTS)
|
||||||
|
}
|
||||||
|
}},
|
||||||
code.WEBPACK: {Name: "webpack", Help: "打包页面", Hand: func(m *ice.Message, arg ...string) {
|
code.WEBPACK: {Name: "webpack", Help: "打包页面", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(code.WEBPACK, cli.BUILD, m.OptionSimple(mdb.NAME))
|
m.Cmdy(code.WEBPACK, cli.BUILD, m.OptionSimple(mdb.NAME))
|
||||||
}},
|
}},
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
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/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
|
"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/nfs"
|
||||||
"shylinux.com/x/icebergs/base/ssh"
|
"shylinux.com/x/icebergs/base/ssh"
|
||||||
@ -37,7 +38,8 @@ func init() {
|
|||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.Prefix(OAUTH_OFFER))
|
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.Prefix(OAUTH_OFFER))
|
||||||
}},
|
}},
|
||||||
CHECK: {Name: "check scope", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
CHECK: {Name: "check scope", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(kit.MergeURL(m.Cmdx(cli.RUNTIME, cli.MAKE_DOMAIN)+OAUTH_APPLY, m.OptionSimple(SCOPE), REDIRECT_URI, m.MergePodURL(OAUTH_REPLY)))
|
m.Echo(kit.MergeURL(m.Cmdx(cli.RUNTIME, cli.MAKE_DOMAIN)+OAUTH_APPLY, m.OptionSimple(SCOPE), REDIRECT_URI,
|
||||||
|
kit.Select(m.MergePodURL(OAUTH_REPLY), m.MergeLink("/chat/"+OAUTH_REPLY), m.Option(ice.MSG_USERPOD) == "")))
|
||||||
}},
|
}},
|
||||||
APPLY: {Name: "apply redirect_uri", Help: "申请", Hand: func(m *ice.Message, arg ...string) {
|
APPLY: {Name: "apply redirect_uri", Help: "申请", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Right(m.Option(SCOPE)) {
|
if m.Right(m.Option(SCOPE)) {
|
||||||
@ -50,11 +52,11 @@ func init() {
|
|||||||
m.Cmd(ssh.SOURCE, ice.ETC_LOCAL_SHY, kit.Dict(nfs.CAT_CONTENT, m.Cmdx(web.SPIDE, ice.DEV, web.SPIDE_GET, m.Option(OFFER))))
|
m.Cmd(ssh.SOURCE, ice.ETC_LOCAL_SHY, kit.Dict(nfs.CAT_CONTENT, m.Cmdx(web.SPIDE, ice.DEV, web.SPIDE_GET, m.Option(OFFER))))
|
||||||
m.ProcessHistory()
|
m.ProcessHistory()
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, mdb.UNIQ, EXPIRES, "720h"))},
|
}, mdb.HashAction(mdb.SHORT, mdb.UNIQ, EXPIRES, "720h"), ctx.CmdAction())},
|
||||||
OAUTH_APPLY: {Name: "/oauth/apply", Help: "授权申请", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
OAUTH_APPLY: {Name: "/oauth/apply", Help: "授权申请", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.RenderCmd(m.Prefix(OAUTH), APPLY)
|
m.RenderCmd(m.Prefix(OAUTH), APPLY)
|
||||||
}},
|
}},
|
||||||
OAUTH_REPLY: {Name: "/oauth/reply", Help: "授权通过", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
OAUTH_REPLY: {Name: "/oauth/reply", Help: "授权通过", Action: ctx.CmdAction(), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.RenderCmd(m.Prefix(OAUTH), REPLY)
|
m.RenderCmd(m.Prefix(OAUTH), REPLY)
|
||||||
}},
|
}},
|
||||||
OAUTH_OFFER: {Name: "/oauth/offer", Help: "授权资源", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
OAUTH_OFFER: {Name: "/oauth/offer", Help: "授权资源", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
@ -184,13 +184,13 @@ func _website_search(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
SRC_WEBSITE = "src/website/"
|
||||||
|
CHAT_WEBSITE = "/chat/website/"
|
||||||
|
)
|
||||||
const WEBSITE = "website"
|
const WEBSITE = "website"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
const (
|
|
||||||
SRC_WEBSITE = "src/website/"
|
|
||||||
CHAT_WEBSITE = "/chat/website/"
|
|
||||||
)
|
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
||||||
WEBSITE: {Name: "website", Help: "网站", Value: kit.Data(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path,type,name,text")},
|
WEBSITE: {Name: "website", Help: "网站", Value: kit.Data(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path,type,name,text")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: map[string]*ice.Command{
|
||||||
|
@ -86,7 +86,10 @@ field "{{.Option "help"}}" {{.Option "key"}}
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
func _autogen_source(m *ice.Message, main, file string) {
|
func _autogen_source(m *ice.Message, main, file string) {
|
||||||
m.Cmd(nfs.PUSH, strings.ReplaceAll(main, ice.PT+GO, ice.PT+SHY), ice.NL, "source "+strings.TrimPrefix(file, ice.SRC+ice.PS))
|
main = strings.ReplaceAll(main, ice.PT+GO, ice.PT+SHY)
|
||||||
|
m.Cmd(nfs.DEFS, main, `chapter "{{.Option "name"}}"
|
||||||
|
`)
|
||||||
|
m.Cmd(nfs.PUSH, main, ice.NL, "source "+strings.TrimPrefix(file, ice.SRC+ice.PS))
|
||||||
}
|
}
|
||||||
func _autogen_mod(m *ice.Message, file string) (mod string) {
|
func _autogen_mod(m *ice.Message, file string) (mod string) {
|
||||||
host := kit.ParseURLMap(m.Option(ice.MSG_USERWEB))[tcp.HOSTNAME]
|
host := kit.ParseURLMap(m.Option(ice.MSG_USERWEB))[tcp.HOSTNAME]
|
||||||
@ -99,6 +102,9 @@ func _autogen_mod(m *ice.Message, file string) (mod string) {
|
|||||||
m.Cmd(nfs.DEFS, file, kit.Format(`module %s
|
m.Cmd(nfs.DEFS, file, kit.Format(`module %s
|
||||||
|
|
||||||
go 1.11
|
go 1.11
|
||||||
|
`, host))
|
||||||
|
m.Cmd(nfs.DEFS, ice.GO_SUM, kit.Format(`
|
||||||
|
|
||||||
`, host))
|
`, host))
|
||||||
|
|
||||||
m.Cmd(nfs.CAT, file, func(line string) {
|
m.Cmd(nfs.CAT, file, func(line string) {
|
||||||
|
@ -95,6 +95,9 @@ func init() {
|
|||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
nfs.AddRewrite(func(msg *ice.Message, name string) []byte {
|
nfs.AddRewrite(func(msg *ice.Message, name string) []byte {
|
||||||
|
if kit.FileExists(name) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if strings.HasPrefix(name, ice.SRC) && kit.FileExists(name) {
|
if strings.HasPrefix(name, ice.SRC) && kit.FileExists(name) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -138,8 +141,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
_binpack_ctx(m, f)
|
_binpack_ctx(m, f)
|
||||||
|
|
||||||
|
fmt.Fprintln(f, _binpack_file(m, ice.GO_MOD))
|
||||||
|
fmt.Fprintln(f, _binpack_file(m, ice.GO_SUM))
|
||||||
|
fmt.Fprintln(f, _binpack_file(m, ice.MAKEFILE))
|
||||||
|
fmt.Fprintln(f, _binpack_file(m, ice.ETC_MISS_SH))
|
||||||
fmt.Fprintln(f, _binpack_file(m, ice.ETC_INIT_SHY))
|
fmt.Fprintln(f, _binpack_file(m, ice.ETC_INIT_SHY))
|
||||||
fmt.Fprintln(f, _binpack_file(m, ice.ETC_EXIT_SHY))
|
fmt.Fprintln(f, _binpack_file(m, ice.ETC_EXIT_SHY))
|
||||||
|
fmt.Fprintln(f, _binpack_file(m, ice.README_MD))
|
||||||
fmt.Fprintln(f)
|
fmt.Fprintln(f)
|
||||||
|
|
||||||
m.Cmd(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields(nfs.PATH)).Tables(func(value map[string]string) {
|
m.Cmd(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields(nfs.PATH)).Tables(func(value map[string]string) {
|
||||||
|
@ -98,6 +98,9 @@ func init() {
|
|||||||
m.Option("httphost", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ice.DF)[0],
|
m.Option("httphost", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ice.DF)[0],
|
||||||
kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ice.DF), 1)))
|
kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ice.DF), 1)))
|
||||||
|
|
||||||
|
m.Option("remote", kit.Select(ice.Info.Make.Remote, strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "config", "remote.origin.url"))))
|
||||||
|
m.Option("pathname", strings.TrimSuffix(path.Base(m.Option("remote")), ".git"))
|
||||||
|
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
arg = append(arg, ice.MISC, ice.CORE, ice.BASE)
|
arg = append(arg, ice.MISC, ice.CORE, ice.BASE)
|
||||||
}
|
}
|
||||||
@ -152,7 +155,7 @@ var _contexts = kit.Dict(
|
|||||||
export ctx_dev={{.Option "httphost"}} ctx_pod={{.Option "user.pod"}}; ctx_temp=$(mktemp); wget -O $ctx_temp $ctx_dev; source $ctx_temp app
|
export ctx_dev={{.Option "httphost"}} ctx_pod={{.Option "user.pod"}}; ctx_temp=$(mktemp); wget -O $ctx_temp $ctx_dev; source $ctx_temp app
|
||||||
`,
|
`,
|
||||||
ice.CORE, `# 源码下载
|
ice.CORE, `# 源码下载
|
||||||
git clone {{.Option "httphost"}}/x/{{.Option "user.pod"}}; cd {{.Option "user.pod"}} && source etc/miss.sh port 9020
|
git clone {{.Option "remote"}}; cd {{.Option "pathname"}} && source etc/miss.sh port 9020
|
||||||
`,
|
`,
|
||||||
ice.BASE, `# 官方下载
|
ice.BASE, `# 官方下载
|
||||||
ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
||||||
|
@ -48,7 +48,6 @@ func init() {
|
|||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: map[string]*ice.Config{
|
||||||
SH: {Name: SH, Help: "命令", Value: kit.Data(PLUG, kit.Dict(
|
SH: {Name: SH, Help: "命令", Value: kit.Data(PLUG, kit.Dict(
|
||||||
mdb.ENGINE, kit.Dict(),
|
|
||||||
SPLIT, kit.Dict("space", " ", "operator", "{[(.,;!|<>)]}"),
|
SPLIT, kit.Dict("space", " ", "operator", "{[(.,;!|<>)]}"),
|
||||||
PREFIX, kit.Dict("#", COMMENT),
|
PREFIX, kit.Dict("#", COMMENT),
|
||||||
SUFFIX, kit.Dict("{", COMMENT),
|
SUFFIX, kit.Dict("{", COMMENT),
|
||||||
|
2
go.mod
2
go.mod
@ -4,6 +4,6 @@ go 1.11
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
shylinux.com/x/go-qrcode v0.0.1
|
shylinux.com/x/go-qrcode v0.0.1
|
||||||
shylinux.com/x/toolkits v0.5.8
|
shylinux.com/x/toolkits v0.5.9
|
||||||
shylinux.com/x/websocket v0.0.1
|
shylinux.com/x/websocket v0.0.1
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
go.sum
@ -1,6 +1,6 @@
|
|||||||
shylinux.com/x/go-qrcode v0.0.1 h1:/eOGqMj1qtgs9Ymd12zTUa1gcJZs9S92kj2lb0QzKsE=
|
shylinux.com/x/go-qrcode v0.0.1 h1:/eOGqMj1qtgs9Ymd12zTUa1gcJZs9S92kj2lb0QzKsE=
|
||||||
shylinux.com/x/go-qrcode v0.0.1/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
shylinux.com/x/go-qrcode v0.0.1/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
||||||
shylinux.com/x/toolkits v0.5.8 h1:8MhHLmglPTPiXAdUgAJXx+gOxJoQzmpNeC7QzsZcjJw=
|
shylinux.com/x/toolkits v0.5.9 h1:d2x4hNp9ariX66w8dsY8qFsPYtP0MYdOhh+exmqECDo=
|
||||||
shylinux.com/x/toolkits v0.5.8/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
|
shylinux.com/x/toolkits v0.5.9/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
|
||||||
shylinux.com/x/websocket v0.0.1 h1:OBc21DxqsGlQ2+Pz76xqLyDNo1LV+PUUqfWi+1PZPDE=
|
shylinux.com/x/websocket v0.0.1 h1:OBc21DxqsGlQ2+Pz76xqLyDNo1LV+PUUqfWi+1PZPDE=
|
||||||
shylinux.com/x/websocket v0.0.1/go.mod h1:AaSpMToOxbMULKQytzczeHPuqb708vK1vrAzCxLo/XE=
|
shylinux.com/x/websocket v0.0.1/go.mod h1:AaSpMToOxbMULKQytzczeHPuqb708vK1vrAzCxLo/XE=
|
||||||
|
4
misc.go
4
misc.go
@ -74,8 +74,8 @@ func (m *Message) Split(str string, arg ...string) *Message { // field sp nl
|
|||||||
func (m *Message) SplitIndex(str string, arg ...string) *Message {
|
func (m *Message) SplitIndex(str string, arg ...string) *Message {
|
||||||
return m.Split(str, kit.Simple("index", arg)...)
|
return m.Split(str, kit.Simple("index", arg)...)
|
||||||
}
|
}
|
||||||
func (m *Message) PushDetail(value interface{}, arg ...interface{}) *Message {
|
func (m *Message) PushDetail(value interface{}, arg ...string) *Message {
|
||||||
return m.Push(CACHE_DETAIL, value, arg...)
|
return m.Push(CACHE_DETAIL, value, kit.Split(kit.Join(arg)))
|
||||||
}
|
}
|
||||||
func (m *Message) PushRecord(value interface{}, arg ...string) *Message {
|
func (m *Message) PushRecord(value interface{}, arg ...string) *Message {
|
||||||
return m.Push("", value, kit.Split(kit.Join(arg)))
|
return m.Push("", value, kit.Split(kit.Join(arg)))
|
||||||
|
@ -276,8 +276,7 @@ func init() {
|
|||||||
"branch_switch": {Name: "branch_switch", Help: "切换", Hand: func(m *ice.Message, arg ...string) {
|
"branch_switch": {Name: "branch_switch", Help: "切换", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_repos_cmd(m.Spawn(), m.Option(REPOS), "checkout", m.Option(BRANCH))
|
_repos_cmd(m.Spawn(), m.Option(REPOS), "checkout", m.Option(BRANCH))
|
||||||
}},
|
}},
|
||||||
"submit": {Name: "submit", Help: "发布", Hand: func(m *ice.Message, arg ...string) {
|
"publish": {Name: "publish", Help: "发布", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(cli.SYSTEM, GIT, PUSH, "-u", kit.Select(m.MergeURL2("/x/")+kit.Select(ice.CONTEXTS, m.Option(ice.MSG_USERPOD)), arg, 0))
|
|
||||||
m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.MISC, ice.CORE)
|
m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.MISC, ice.CORE)
|
||||||
}},
|
}},
|
||||||
BRANCH: {Name: "branch", Help: "分支", Hand: func(m *ice.Message, arg ...string) {
|
BRANCH: {Name: "branch", Help: "分支", Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -307,7 +306,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.Action(PULL, MAKE, PUSH, TAGS, STASH, PIE, "submit")
|
m.Action(PULL, MAKE, PUSH, TAGS, STASH, PIE, "publish")
|
||||||
|
|
||||||
files, adds, dels, last := _status_list(m)
|
files, adds, dels, last := _status_list(m)
|
||||||
m.Status("files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME))
|
m.Status("files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user