mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt git
This commit is contained in:
parent
f1f89f67b8
commit
eaaa165065
@ -218,6 +218,7 @@ func _ssh_config(m *ice.Message) *ssh.ServerConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
res = nil
|
||||||
return &ssh.Permissions{Extensions: meta}, res
|
return &ssh.Permissions{Extensions: meta}, res
|
||||||
},
|
},
|
||||||
PasswordCallback: func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) {
|
PasswordCallback: func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) {
|
||||||
|
@ -23,72 +23,14 @@ func init() {
|
|||||||
INSTALL: {Name: INSTALL, Help: "安装", Value: kit.Data(
|
INSTALL: {Name: INSTALL, Help: "安装", Value: kit.Data(
|
||||||
kit.MDB_SHORT, kit.MDB_NAME, kit.MDB_PATH, "usr/install",
|
kit.MDB_SHORT, kit.MDB_NAME, kit.MDB_PATH, "usr/install",
|
||||||
"contexts", kit.Dict(
|
"contexts", kit.Dict(
|
||||||
"tmux", kit.Dict(
|
"base", `mkdir contexts; cd contexts
|
||||||
"centos", `
|
export ctx_dev={{.Option "httphost"}}; curl $ctx_dev/publish/ice.sh | sh
|
||||||
yum update -y && yum install -y wget tmux curl
|
bin/ice.sh`,
|
||||||
wget {{.Option "host"}}/publish/tmux.conf
|
"miss", `
|
||||||
tmux -f tmux.conf
|
touch ~/.ssh/config; [ -z "$(cat ~/.ssh/config|grep 'Host {{.Option "hostname"}}')" ] && echo -e "HOST {{.Option "hostname"}}\n Port 9030" >> ~/.ssh/config
|
||||||
`,
|
git clone {{.Option "user.name"}}@{{.Option "hostname"}}:{{.Option "hostpath"}} && cd contexts
|
||||||
"ubuntu", `
|
git clone {{.Option "httphost"}}/code/git/proxy/shylinux/contexts && cd contexts
|
||||||
apt update -y && apt install -y wget tmux curl
|
source etc/miss.sh`,
|
||||||
wget {{.Option "host"}}/publish/tmux.conf
|
|
||||||
tmux -f tmux.conf
|
|
||||||
`,
|
|
||||||
"alpine", `
|
|
||||||
apk update && apk add wget tmux curl
|
|
||||||
wget {{.Option "host"}}/publish/tmux.conf
|
|
||||||
tmux -f tmux.conf
|
|
||||||
`,
|
|
||||||
"darwin", `
|
|
||||||
brew update && brew install wget tmux curl
|
|
||||||
wget {{.Option "host"}}/publish/tmux.conf
|
|
||||||
tmux -f tmux.conf
|
|
||||||
`,
|
|
||||||
),
|
|
||||||
"base", kit.Dict(
|
|
||||||
"centos", `
|
|
||||||
yum update -y && yum install -y curl
|
|
||||||
mkdir contexts; cd contexts
|
|
||||||
ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh
|
|
||||||
`,
|
|
||||||
"ubuntu", `
|
|
||||||
apt update -y && apt install -y curl
|
|
||||||
mkdir contexts; cd contexts
|
|
||||||
ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh
|
|
||||||
`,
|
|
||||||
"alpine", `
|
|
||||||
apk update && apk add curl
|
|
||||||
mkdir contexts; cd contexts
|
|
||||||
ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh
|
|
||||||
`,
|
|
||||||
"darwin", `
|
|
||||||
brew update && brew install curl
|
|
||||||
mkdir contexts; cd contexts
|
|
||||||
ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh
|
|
||||||
`,
|
|
||||||
),
|
|
||||||
"miss", kit.Dict(
|
|
||||||
"centos", `
|
|
||||||
yum update -y && yum install -y git vim make go
|
|
||||||
git clone https://github.com/shylinux/contexts && cd contexts
|
|
||||||
source etc/miss.sh
|
|
||||||
`,
|
|
||||||
"ubuntu", `
|
|
||||||
apt update -y && apt install -y git vim make golang
|
|
||||||
git clone https://github.com/shylinux/contexts && cd contexts
|
|
||||||
source etc/miss.sh
|
|
||||||
`,
|
|
||||||
"alpine", `
|
|
||||||
apk update && apk add git vim make go
|
|
||||||
git clone https://github.com/shylinux/contexts && cd contexts
|
|
||||||
source etc/miss.sh
|
|
||||||
`,
|
|
||||||
"darwin", `
|
|
||||||
brew update && brew install git vim make
|
|
||||||
git clone https://github.com/shylinux/contexts && cd contexts
|
|
||||||
source etc/miss.sh
|
|
||||||
`,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)},
|
)},
|
||||||
},
|
},
|
||||||
@ -96,18 +38,12 @@ source etc/miss.sh
|
|||||||
INSTALL: {Name: "install name=auto port=auto path=auto auto", Help: "安装", Meta: kit.Dict(), Action: map[string]*ice.Action{
|
INSTALL: {Name: "install name=auto port=auto path=auto auto", Help: "安装", Meta: kit.Dict(), Action: map[string]*ice.Action{
|
||||||
"contexts": {Name: "contexts item os", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
"contexts": {Name: "contexts item os", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
|
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
|
||||||
m.Option("host", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1)))
|
m.Option("httphost", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1)))
|
||||||
|
m.Option("hostport", fmt.Sprintf("%s:%s", strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1)))
|
||||||
|
m.Option("hostname", strings.Split(u.Host, ":")[0])
|
||||||
|
m.Option("hostpath", kit.Path("./"))
|
||||||
|
|
||||||
txt, sys := "hello world", kit.Select("centos", arg, 1)
|
if buf, err := kit.Render(m.Conf(INSTALL, kit.Keys("meta.contexts", kit.Select("base", arg, 0))), m); m.Assert(err) {
|
||||||
switch text := m.Confv(INSTALL, kit.Keys("meta.contexts", kit.Select("tmux", arg, 0))).(type) {
|
|
||||||
case map[string]interface{}:
|
|
||||||
m.Cmdy("web.wiki.spark", sys)
|
|
||||||
txt = kit.Format(text[sys])
|
|
||||||
case string:
|
|
||||||
txt = text
|
|
||||||
}
|
|
||||||
|
|
||||||
if buf, err := kit.Render(txt, m); m.Assert(err) {
|
|
||||||
m.Cmdy("web.wiki.spark", "shell", string(buf))
|
m.Cmdy("web.wiki.spark", "shell", string(buf))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
@ -42,6 +42,7 @@ func init() {
|
|||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
PUBLISH: {Name: "publish path=auto auto 火山架 冰山架 神农架", Help: "发布", Action: map[string]*ice.Action{
|
PUBLISH: {Name: "publish path=auto auto 火山架 冰山架 神农架", Help: "发布", Action: map[string]*ice.Action{
|
||||||
"ish": {Name: "ish", Help: "神农架", Hand: func(m *ice.Message, arg ...string) {
|
"ish": {Name: "ish", Help: "神农架", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_publish_file(m, "etc/conf/tmux.conf")
|
||||||
m.Option(nfs.DIR_REG, ".*\\.(sh|vim|conf)")
|
m.Option(nfs.DIR_REG, ".*\\.(sh|vim|conf)")
|
||||||
m.Cmdy(nfs.DIR, m.Conf(PUBLISH, kit.META_PATH), "time size line path link")
|
m.Cmdy(nfs.DIR, m.Conf(PUBLISH, kit.META_PATH), "time size line path link")
|
||||||
}},
|
}},
|
||||||
|
@ -19,7 +19,7 @@ var refer = `<ul class="story"
|
|||||||
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
||||||
{{range $index, $value := .Optionv "list"}}<li>{{index $value 0}}: <a href="{{index $value 1}}" target="_blank">{{index $value 1}}</a></li>{{end}}</ul>`
|
{{range $index, $value := .Optionv "list"}}<li>{{index $value 0}}: <a href="{{index $value 1}}" target="_blank">{{index $value 1}}</a></li>{{end}}</ul>`
|
||||||
var spark = `<p class="story {{.Option "style"}}" {{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}} data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
var spark = `<p class="story {{.Option "style"}}" {{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}} data-type="{{.Option "type"}}" data-name="{{.Option "name"}}">{{.Option "text"}}</p>`
|
||||||
|
|
||||||
var chart = `<svg class="story" vertion="1.1" xmlns="http://www.w3.org/2000/svg" dominant-baseline="middle" text-anchor="middle"
|
var chart = `<svg class="story" vertion="1.1" xmlns="http://www.w3.org/2000/svg" dominant-baseline="middle" text-anchor="middle"
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
||||||
|
@ -384,7 +384,7 @@ func init() {
|
|||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "shell", "mysql", "redis":
|
case "shell", "mysql", "redis":
|
||||||
arg[1] = strings.TrimSpace(arg[1])
|
arg[1] = strings.TrimSpace(arg[1])
|
||||||
m.Echo(`<div class="story" data-type="spark" data-name="%s" data-text="%s">`, arg[0], arg[1])
|
m.Echo(`<div class="story" data-type="spark" data-name="%s">`, arg[0])
|
||||||
for _, l := range strings.Split(arg[1], "\n") {
|
for _, l := range strings.Split(arg[1], "\n") {
|
||||||
m.Echo("<div>")
|
m.Echo("<div>")
|
||||||
m.Echo(kit.Select(arg[0]+"> ", m.Conf(SPARK, kit.Keys("meta.prompt", arg[0]))))
|
m.Echo(kit.Select(arg[0]+"> ", m.Conf(SPARK, kit.Keys("meta.prompt", arg[0]))))
|
||||||
|
1
go.mod
1
go.mod
@ -6,6 +6,7 @@ require (
|
|||||||
fyne.io/fyne v1.3.3
|
fyne.io/fyne v1.3.3
|
||||||
github.com/gomarkdown/markdown v0.0.0-20200824053859-8c8b3816f167
|
github.com/gomarkdown/markdown v0.0.0-20200824053859-8c8b3816f167
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
||||||
|
github.com/google/gitprotocolio v0.0.0-20180630173033-8d2b3b1c37f6
|
||||||
github.com/gorilla/websocket v1.4.2
|
github.com/gorilla/websocket v1.4.2
|
||||||
github.com/kr/pty v1.1.1
|
github.com/kr/pty v1.1.1
|
||||||
github.com/nareix/joy4 v0.0.0-20200507095837-05a4ffbb5369
|
github.com/nareix/joy4 v0.0.0-20200507095837-05a4ffbb5369
|
||||||
|
2
go.sum
2
go.sum
@ -20,6 +20,8 @@ github.com/gomarkdown/markdown v0.0.0-20200824053859-8c8b3816f167/go.mod h1:aii0
|
|||||||
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
|
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||||
github.com/gomodule/redigo/redis v0.0.0-do-not-use h1:J7XIp6Kau0WoyT4JtXHT3Ei0gA1KkSc6bc87j9v9WIo=
|
github.com/gomodule/redigo/redis v0.0.0-do-not-use h1:J7XIp6Kau0WoyT4JtXHT3Ei0gA1KkSc6bc87j9v9WIo=
|
||||||
|
github.com/google/gitprotocolio v0.0.0-20180630173033-8d2b3b1c37f6 h1:j5r184GepPynGzPVmz/nTUsZBW2Tl237S0WN9JcbOAU=
|
||||||
|
github.com/google/gitprotocolio v0.0.0-20180630173033-8d2b3b1c37f6/go.mod h1:ZWHBOUQ5S1VRRi7XG5FXPOxxIwwsK4suKZ+MSgq2zTg=
|
||||||
github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s=
|
github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s=
|
||||||
github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/shylinux/icebergs/core/code"
|
"github.com/shylinux/icebergs/core/code"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
|
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
@ -423,13 +422,16 @@ var Index = &ice.Context{Name: GIT, Help: "代码库",
|
|||||||
m.Sort("name")
|
m.Sort("name")
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"/repos/": {Name: "/repos/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"/proxy/": {Name: "/repos/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
switch arg[2] {
|
s := &httpProxyServer{"http://127.0.0.1:9020/code/git/serve/" + path.Join(arg...)}
|
||||||
case "info":
|
s.infoRefsHandler(m.W, m.R)
|
||||||
http.ServeFile(m.W, m.R, path.Join("demo.git", path.Join(arg[3:]...)))
|
|
||||||
}
|
|
||||||
m.Render(ice.RENDER_VOID)
|
m.Render(ice.RENDER_VOID)
|
||||||
}},
|
}},
|
||||||
|
"/serve/": {Name: "/repos/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
p := kit.Path(path.Join(".ish/pluged/github.com", path.Join(arg[:2]...)))
|
||||||
|
m.Cmdy(cli.SYSTEM, "git-upload-pack", p)
|
||||||
|
m.Render(ice.RENDER_RESULT)
|
||||||
|
}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@ cd ./install
|
|||||||
`
|
`
|
||||||
|
|
||||||
chapter "应用"
|
chapter "应用"
|
||||||
|
refer `
|
||||||
|
go https://github.com/google/gitprotocolio
|
||||||
|
`
|
||||||
field "代码统计" web.code.git.total
|
field "代码统计" web.code.git.total
|
||||||
field "提交趋势" web.code.git.trend args icebergs
|
field "提交趋势" web.code.git.trend args icebergs
|
||||||
field "代码结构" web.code.git.spide args icebergs
|
field "代码结构" web.code.git.spide args icebergs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user