forked from x/ContextOS
add mdb.redis
This commit is contained in:
parent
b1835f08b7
commit
3c4b9118d7
@ -3,8 +3,9 @@
|
|||||||
ctx_log=${ctx_log:="var/log"}
|
ctx_log=${ctx_log:="var/log"}
|
||||||
ctx_app=${ctx_app:="bench"}
|
ctx_app=${ctx_app:="bench"}
|
||||||
ctx_bin=${ctx_app} && [ -f bin/${ctx_app} ] && ctx_bin=$(pwd)/bin/${ctx_app}
|
ctx_bin=${ctx_app} && [ -f bin/${ctx_app} ] && ctx_bin=$(pwd)/bin/${ctx_app}
|
||||||
# ctx_box=
|
|
||||||
# ctx_cas=
|
# ctx_cas=
|
||||||
|
# ctx_ups=
|
||||||
|
# ctx_box=
|
||||||
ctx_dev=${ctx_dev:="https://shylinux.com"}
|
ctx_dev=${ctx_dev:="https://shylinux.com"}
|
||||||
ctx_root=${ctx_root:=/usr/local/context}
|
ctx_root=${ctx_root:=/usr/local/context}
|
||||||
ctx_home=${ctx_home:=~/context}
|
ctx_home=${ctx_home:=~/context}
|
||||||
@ -54,7 +55,11 @@ action() {
|
|||||||
|
|
||||||
dir=./ && [ -d "$1" ] && dir=$1 && shift
|
dir=./ && [ -d "$1" ] && dir=$1 && shift
|
||||||
[ -d "${dir}" ] && cd ${dir}
|
[ -d "${dir}" ] && cd ${dir}
|
||||||
log "dev:$ctx_dev\ndir: $dir\nbin: $ctx_bin\n"
|
log "ups:$ctx_ups"
|
||||||
|
log "box:$ctx_box"
|
||||||
|
log "dev:$ctx_dev"
|
||||||
|
log "bin:$ctx_bin"
|
||||||
|
log "dir:$dir"
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
install) shift && install "$@";;
|
install) shift && install "$@";;
|
||||||
|
@ -103,7 +103,8 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
"runtime": &ctx.Config{Name: "runtime", Value: map[string]interface{}{
|
"runtime": &ctx.Config{Name: "runtime", Value: map[string]interface{}{
|
||||||
"init_env": []interface{}{
|
"init_env": []interface{}{
|
||||||
"ctx_log", "ctx_app", "ctx_bin",
|
"ctx_log", "ctx_app", "ctx_bin",
|
||||||
"ctx_box", "ctx_cas", "ctx_dev",
|
"ctx_ups", "ctx_box", "ctx_dev",
|
||||||
|
"ctx_cas",
|
||||||
"ctx_root", "ctx_home",
|
"ctx_root", "ctx_home",
|
||||||
"web_port", "ssh_port",
|
"web_port", "ssh_port",
|
||||||
},
|
},
|
||||||
@ -137,9 +138,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
},
|
},
|
||||||
"import": []interface{}{
|
"import": []interface{}{
|
||||||
"github.com/nsf/termbox-go",
|
"github.com/nsf/termbox-go",
|
||||||
"github.com/skip2/go-qrcode",
|
"github.com/gomodule/redigo",
|
||||||
"github.com/go-sql-driver/mysql",
|
"github.com/go-sql-driver/mysql",
|
||||||
"github.com/gomarkdown/markdown",
|
"github.com/gomarkdown/markdown",
|
||||||
|
"github.com/skip2/go-qrcode",
|
||||||
"github.com/PuerkitoBio/goquery",
|
"github.com/PuerkitoBio/goquery",
|
||||||
"github.com/go-cas/cas",
|
"github.com/go-cas/cas",
|
||||||
},
|
},
|
||||||
@ -163,6 +165,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
"upgrade": &ctx.Config{Name: "upgrade", Value: map[string]interface{}{
|
"upgrade": &ctx.Config{Name: "upgrade", Value: map[string]interface{}{
|
||||||
"system": []interface{}{"boot.sh", "node.sh", "init.shy", "common.shy", "exit.shy"},
|
"system": []interface{}{"boot.sh", "node.sh", "init.shy", "common.shy", "exit.shy"},
|
||||||
"portal": []interface{}{"template.tar.gz", "librarys.tar.gz"},
|
"portal": []interface{}{"template.tar.gz", "librarys.tar.gz"},
|
||||||
|
"script": []interface{}{"test.php"},
|
||||||
"list": map[string]interface{}{
|
"list": map[string]interface{}{
|
||||||
"bench": "bin/bench.new",
|
"bench": "bin/bench.new",
|
||||||
"boot_sh": "bin/boot.sh",
|
"boot_sh": "bin/boot.sh",
|
||||||
@ -547,6 +550,15 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
list = append(list, []string{value})
|
list = append(list, []string{value})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get",
|
||||||
|
"cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list)
|
||||||
|
|
||||||
|
case "import":
|
||||||
|
list := [][]string{}
|
||||||
|
m.Confm("project", "import", func(index int, value string) {
|
||||||
|
list = append(list, []string{value})
|
||||||
|
})
|
||||||
|
|
||||||
m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get",
|
m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get",
|
||||||
"cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list)
|
"cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list)
|
||||||
}
|
}
|
||||||
@ -569,6 +581,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
[]string{"windows", "amd64"},
|
[]string{"windows", "amd64"},
|
||||||
[]string{"darwin", "amd64"},
|
[]string{"darwin", "amd64"},
|
||||||
})
|
})
|
||||||
|
m.Echo("done %s", m.Time())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,9 +601,11 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
})
|
})
|
||||||
|
|
||||||
p := m.Cmdx("nfs.path", m.Conf("compile", "bench"))
|
p := m.Cmdx("nfs.path", m.Conf("compile", "bench"))
|
||||||
if m.Cmdy("cli.system", env, "go", "build", "-o", path.Join(m.Conf("publish", "path"), name), p); m.Result(0) == "" {
|
q := path.Join(m.Conf("publish", "path"), name)
|
||||||
|
if m.Cmdy("cli.system", env, "go", "build", "-o", q, p); m.Result(0) == "" {
|
||||||
|
m.Append("time", m.Time())
|
||||||
m.Append("bin", name)
|
m.Append("bin", name)
|
||||||
m.Append("hash", kit.Hashs(p))
|
m.Append("hash", kit.Hashs(q))
|
||||||
m.Table()
|
m.Table()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -625,7 +640,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
|
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
"upgrade": &ctx.Command{Name: "upgrade bench|system|extend|plugin|portal|client|script|project", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"upgrade": &ctx.Command{Name: "upgrade project|bench|system|portal|script", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.Cmdy("ctx.config", "upgrade")
|
m.Cmdy("ctx.config", "upgrade")
|
||||||
return
|
return
|
||||||
@ -640,10 +655,16 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
restart := false
|
restart := false
|
||||||
for _, link := range kit.View([]string{arg[0]}, m.Confm("upgrade")) {
|
for _, link := range kit.View([]string{arg[0]}, m.Confm("upgrade")) {
|
||||||
file := kit.Select(link, m.Conf("upgrade", []string{"list", strings.Replace(link, ".", "_", -1)}))
|
file := kit.Select(link, m.Conf("upgrade", []string{"list", strings.Replace(link, ".", "_", -1)}))
|
||||||
|
if arg[0] == "script" {
|
||||||
|
file = path.Join("usr/script", file)
|
||||||
|
}
|
||||||
|
|
||||||
if m.Cmd("web.get", "dev", fmt.Sprintf("publish/%s", link),
|
m.Cmd("web.get", "dev", fmt.Sprintf("publish/%s", link),
|
||||||
"GOOS", m.Conf("runtime", "host.GOOS"), "GOARCH", m.Conf("runtime", "host.GOARCH"),
|
"GOARCH", m.Conf("runtime", "host.GOARCH"),
|
||||||
"save", file); strings.HasPrefix(file, "bin/") {
|
"GOOS", m.Conf("runtime", "host.GOOS"),
|
||||||
|
"upgrade", arg[0], "save", file)
|
||||||
|
|
||||||
|
if strings.HasPrefix(file, "bin/") {
|
||||||
if m.Cmd("cli.system", "chmod", "a+x", file); link == "bench" {
|
if m.Cmd("cli.system", "chmod", "a+x", file); link == "bench" {
|
||||||
m.Cmd("cli.system", "mv", "bin/bench", fmt.Sprintf("bin/bench_%s", m.Time("20060102_150405")))
|
m.Cmd("cli.system", "mv", "bin/bench", fmt.Sprintf("bin/bench_%s", m.Time("20060102_150405")))
|
||||||
m.Cmd("cli.system", "mv", "bin/bench.new", "bin/bench")
|
m.Cmd("cli.system", "mv", "bin/bench.new", "bin/bench")
|
||||||
@ -652,8 +673,9 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
restart = true
|
restart = true
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Add("append", "hash", kit.Hashs(file))
|
m.Add("append", "time", m.Time())
|
||||||
m.Add("append", "file", file)
|
m.Add("append", "file", file)
|
||||||
|
m.Add("append", "hash", kit.Hashs(file))
|
||||||
|
|
||||||
if strings.HasSuffix(link, ".tar.gz") {
|
if strings.HasSuffix(link, ".tar.gz") {
|
||||||
m.Cmd("cli.system", "tar", "-xvf", file, "-C", path.Dir(file))
|
m.Cmd("cli.system", "tar", "-xvf", file, "-C", path.Dir(file))
|
||||||
@ -686,6 +708,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
m.Echo(", wait 1s")
|
m.Echo(", wait 1s")
|
||||||
m.GoFunc(m, func(m *ctx.Message) {
|
m.GoFunc(m, func(m *ctx.Message) {
|
||||||
time.Sleep(time.Second * 1)
|
time.Sleep(time.Second * 1)
|
||||||
|
m.Cmd("nfs._exit")
|
||||||
os.Exit(kit.Int(code))
|
os.Exit(kit.Int(code))
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
@ -2,10 +2,13 @@ package mdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"contexts/ctx"
|
"contexts/ctx"
|
||||||
|
"net"
|
||||||
|
"time"
|
||||||
"toolkit"
|
"toolkit"
|
||||||
|
|
||||||
"database/sql"
|
"database/sql"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
"github.com/gomodule/redigo/redis"
|
||||||
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -14,6 +17,7 @@ import (
|
|||||||
|
|
||||||
type MDB struct {
|
type MDB struct {
|
||||||
*sql.DB
|
*sql.DB
|
||||||
|
conn redis.Conn
|
||||||
*ctx.Context
|
*ctx.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +126,30 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
kit.Select("数据源", m.Option("dbhelp")), arg...)
|
kit.Select("数据源", m.Option("dbhelp")), arg...)
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
"redis": &ctx.Command{Name: "redis conn address [protocol]", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) {
|
||||||
|
switch arg[0] {
|
||||||
|
case "conn":
|
||||||
|
c, e := net.Dial(kit.Select("tcp", arg, 2), arg[1])
|
||||||
|
m.Assert(e)
|
||||||
|
mdb.conn = redis.NewConn(c, time.Second*10, time.Second*10)
|
||||||
|
default:
|
||||||
|
args := []interface{}{}
|
||||||
|
for _, v:=range arg[1:] {
|
||||||
|
args = append(args, v)
|
||||||
|
}
|
||||||
|
res, err := mdb.conn.Do(arg[0], args...)
|
||||||
|
m.Assert(err)
|
||||||
|
switch val := res.(type) {
|
||||||
|
case redis.Error:
|
||||||
|
m.Echo("%v", val)
|
||||||
|
default:
|
||||||
|
m.Echo("%v", kit.Format(res))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}},
|
||||||
"exec": &ctx.Command{Name: "exec sql [arg]", Help: "操作数据库, sql: SQL语句, arg: 操作参数", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"exec": &ctx.Command{Name: "exec sql [arg]", Help: "操作数据库, sql: SQL语句, arg: 操作参数", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) && mdb.DB != nil {
|
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) && mdb.DB != nil {
|
||||||
which := make([]interface{}, 0, len(arg))
|
which := make([]interface{}, 0, len(arg))
|
||||||
|
@ -1146,6 +1146,10 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
|||||||
m.Conf("paths", -2, m.Conf("runtime", "boot.ctx_root"))
|
m.Conf("paths", -2, m.Conf("runtime", "boot.ctx_root"))
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
"_exit": &ctx.Command{Name: "_init", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
termbox.Close()
|
||||||
|
return
|
||||||
|
}},
|
||||||
"pwd": &ctx.Command{Name: "pwd [all] | [[index] path] ", Help: "工作目录,all: 查看所有, index path: 设置路径, path: 设置当前路径", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"pwd": &ctx.Command{Name: "pwd [all] | [[index] path] ", Help: "工作目录,all: 查看所有, index path: 设置路径, path: 设置当前路径", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
if len(arg) > 0 && arg[0] == "all" {
|
if len(arg) > 0 && arg[0] == "all" {
|
||||||
m.Cmdy("nfs.config", "paths")
|
m.Cmdy("nfs.config", "paths")
|
||||||
|
@ -71,21 +71,6 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"project": []interface{}{
|
"project": []interface{}{
|
||||||
map[string]interface{}{"componet_name": "compile", "componet_help": "compile",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
|
||||||
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "compile",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "button", "value": "编译"},
|
|
||||||
},
|
|
||||||
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "runtime", "componet_help": "runtime",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Runtime", "componet_init": "",
|
|
||||||
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "runtime",
|
|
||||||
"componet_args": []interface{}{"system"}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "button", "value": "运行"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "context", "componet_help": "context",
|
map[string]interface{}{"componet_name": "context", "componet_help": "context",
|
||||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
"componet_type": "private", "componet_ctx": "ctx", "componet_cmd": "context",
|
"componet_type": "private", "componet_ctx": "ctx", "componet_cmd": "context",
|
||||||
@ -174,7 +159,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "gg"},
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "gg", "view": "hide"},
|
||||||
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"status", ""}},
|
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"status", ""}},
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
},
|
},
|
||||||
@ -184,13 +169,71 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "gg"},
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "gg", "view": "hide"},
|
||||||
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"deploygo", "deploy"}},
|
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"deploygo", "deploy"}},
|
||||||
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_dir"},
|
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_dir"},
|
||||||
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_branch"},
|
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_branch"},
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
map[string]interface{}{"componet_name": "php", "componet_help": "php",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "php"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "usr/script/test.php"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "redis", "componet_help": "redis",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "context", "view": "hide"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "mdb", "view": "hide"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "redis", "view": "hide"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "get"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "test"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"context": []interface{}{
|
||||||
|
map[string]interface{}{"componet_name": "runtime", "componet_help": "runtime",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Runtime", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "runtime",
|
||||||
|
"componet_args": []interface{}{"system"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "button", "value": "运行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "project", "componet_help": "project",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "componet", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "project",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{"import"}},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "compile", "componet_help": "compile",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "compile",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "action"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "编译"},
|
||||||
|
},
|
||||||
|
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "publish", "componet_help": "publish",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "compile",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "action"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "编译"},
|
||||||
|
},
|
||||||
|
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, Help: "组件列表"},
|
}, Help: "组件列表"},
|
||||||
},
|
},
|
||||||
@ -386,6 +429,11 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
}
|
}
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "auto": // 自动连接
|
case "auto": // 自动连接
|
||||||
|
m.Log("fuck", "what %v", m.Conf("runtime", "boot.ctx_ups"))
|
||||||
|
if m.Confs("runtime", "boot.ctx_ups") {
|
||||||
|
m.Cmd("ssh.remote", "dial", m.Conf("runtime", "boot.ctx_ups"))
|
||||||
|
break
|
||||||
|
}
|
||||||
if m.Cmd("ssh.remote", "dial", "dev", "/shadow"); !m.Confs("runtime", "boot.ctx_box") {
|
if m.Cmd("ssh.remote", "dial", "dev", "/shadow"); !m.Confs("runtime", "boot.ctx_box") {
|
||||||
m.Cmd("ssh.remote", "listen", m.Conf("runtime", "boot.ssh_port"))
|
m.Cmd("ssh.remote", "listen", m.Conf("runtime", "boot.ssh_port"))
|
||||||
m.Cmd("web.serve", "usr", m.Conf("runtime", "boot.web_port"))
|
m.Cmd("web.serve", "usr", m.Conf("runtime", "boot.web_port"))
|
||||||
|
@ -1128,8 +1128,14 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
if strings.HasSuffix(key, "bench") {
|
if strings.HasSuffix(key, "bench") {
|
||||||
key = key + "." + m.Option("GOOS") + "." + m.Option("GOARCH")
|
key = key + "." + m.Option("GOOS") + "." + m.Option("GOARCH")
|
||||||
}
|
}
|
||||||
|
p := ""
|
||||||
|
if m.Option("upgrade") == "script" {
|
||||||
|
p = m.Cmdx("nfs.path", path.Join("usr/script", key))
|
||||||
|
}
|
||||||
key = strings.Replace(key, ".", "_", -1)
|
key = strings.Replace(key, ".", "_", -1)
|
||||||
p := m.Cmdx("nfs.path", path.Join(m.Conf("publish", "path"), key))
|
if p == "" {
|
||||||
|
p = m.Cmdx("nfs.path", path.Join(m.Conf("publish", "path"), key))
|
||||||
|
}
|
||||||
if p == "" {
|
if p == "" {
|
||||||
p = m.Cmdx("nfs.path", m.Conf("publish", []string{"list", key}))
|
p = m.Cmdx("nfs.path", m.Conf("publish", []string{"list", key}))
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,8 @@ func Format(arg ...interface{}) string {
|
|||||||
result = append(result, fmt.Sprintf("%t", val))
|
result = append(result, fmt.Sprintf("%t", val))
|
||||||
case string:
|
case string:
|
||||||
result = append(result, val)
|
result = append(result, val)
|
||||||
|
case []byte:
|
||||||
|
result = append(result, string(val))
|
||||||
case []rune:
|
case []rune:
|
||||||
result = append(result, string(val))
|
result = append(result, string(val))
|
||||||
case []string:
|
case []string:
|
||||||
|
@ -64,4 +64,5 @@ fieldset.Steam div.create pre:hover {
|
|||||||
|
|
||||||
fieldset div.output {
|
fieldset div.output {
|
||||||
clear:both;
|
clear:both;
|
||||||
|
max-height:800px;
|
||||||
}
|
}
|
||||||
|
@ -15,15 +15,26 @@ fieldset {
|
|||||||
legend {
|
legend {
|
||||||
margin-left:10px;
|
margin-left:10px;
|
||||||
}
|
}
|
||||||
fieldset div.output {
|
fieldset form.option div {
|
||||||
padding:6px;
|
margin-right:6px;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
fieldset form.option div.hide {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
fieldset form.option div input.args {
|
||||||
|
width:80px;
|
||||||
|
}
|
||||||
|
fieldset form.option div.cmd input.args {
|
||||||
|
color:white;
|
||||||
|
background-color: black;
|
||||||
|
width:160px;
|
||||||
}
|
}
|
||||||
fieldset form.option label {
|
fieldset form.option label {
|
||||||
margin-right:6px;
|
margin-right:6px;
|
||||||
}
|
}
|
||||||
fieldset form.option div {
|
fieldset div.output {
|
||||||
margin-right:6px;
|
padding:6px;
|
||||||
float:left;
|
|
||||||
}
|
}
|
||||||
fieldset div.output div.item:hover {
|
fieldset div.output div.item:hover {
|
||||||
background-color:red;
|
background-color:red;
|
||||||
@ -40,6 +51,7 @@ fieldset div.output div.code {
|
|||||||
padding:10px;
|
padding:10px;
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
border:solid 3px green;
|
border:solid 3px green;
|
||||||
|
max-height:640px;
|
||||||
}
|
}
|
||||||
fieldset div.output div.code span.red {
|
fieldset div.output div.code span.red {
|
||||||
color:red;
|
color:red;
|
||||||
|
@ -494,7 +494,7 @@ function Plugin(field, tool, args, plugin) {
|
|||||||
item.className = "args"
|
item.className = "args"
|
||||||
}
|
}
|
||||||
|
|
||||||
var ui = kit.AppendChild(option, [{type: "div", list: [{type: "label", inner: item.label||""}, input]}])
|
var ui = kit.AppendChild(option, [{view: [item.view||""], list: [{type: "label", inner: item.label||""}, input]}])
|
||||||
|
|
||||||
page.plugin = field
|
page.plugin = field
|
||||||
page.input = ui[name]
|
page.input = ui[name]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user