1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-26 02:17:30 +08:00
This commit is contained in:
harveyshao 2022-12-15 15:20:22 +08:00
parent 3ef13accf7
commit 0274061161
6 changed files with 12 additions and 37 deletions

View File

@ -39,7 +39,7 @@ password: %s
return []string{"--config=config", kit.Path(nfs.PWD)}
})
}
func (s server) List(m *ice.Message, arg ...string) *ice.Message {
func (s server) List(m *ice.Message, arg ...string) {
if s.Code.List(m, "", arg...); len(arg) == 0 {
m.Tables(func(value ice.Maps) {
switch value[cli.STATUS] {
@ -50,7 +50,5 @@ func (s server) List(m *ice.Message, arg ...string) *ice.Message {
}
})
}
return m
}
func init() { ice.CodeCtxCmd(server{}) }

View File

@ -17,7 +17,7 @@ const (
type compile struct {
ice.Code
regexp string `data:".*.java"`
regexp string `data:".*\.java$"`
linux string `data:"https://mirrors.huaweicloud.com/openjdk/18/openjdk-18_linux-x64_bin.tar.gz"`
list string `name:"list path auto listScript order install" help:"编译器"`
}
@ -26,14 +26,10 @@ func (s compile) Init(m *ice.Message) {
cli.IsAlpine(m.Message, JAVA, "openjdk8")
cli.IsAlpine(m.Message, JAVAC, "openjdk8")
cli.IsAlpine(m.Message, MVN, "maven openjdk8")
cli.IsCentos(m.Message, JAVA, "java-1.8.0-openjdk-devel.x86_64")
cli.IsCentos(m.Message, JAVAC, "java-1.8.0-openjdk-devel.x86_64")
cli.IsCentos(m.Message, MVN, "maven java-1.8.0-openjdk-devel.x86_64")
}
func (s compile) Order(m *ice.Message) {
s.Code.Order(m, "", ice.BIN)
}
func (s compile) List(m *ice.Message, arg ...string) {
s.Code.Source(m, "", arg...)
}
@ -42,5 +38,4 @@ func (s compile) RunScript(m *ice.Message) {
s.Code.System(m, nfs.PWD, JAVA, "-cp", kit.Path(ice.BIN), strings.TrimPrefix(strings.TrimSuffix(m.Option(nfs.PATH), ".java"), "src/"))
}
}
func init() { ice.CodeCtxCmd(compile{}) }

View File

@ -8,9 +8,6 @@ type maven struct {
list string `name:"list path auto order install" help:"打包构建"`
}
func (s maven) Order(m *ice.Message) {
s.Code.Order(m, "", ice.BIN)
}
func (s maven) List(m *ice.Message, arg ...string) {
s.Code.Source(m, "", arg...)
}

View File

@ -13,38 +13,25 @@ import (
type spring struct {
ice.Code
linux string `data:"https://mirrors.tencent.com/macports/distfiles/spring-boot-cli/spring-boot-cli-2.7.0-bin.tar.gz"`
ice.Hash
short string `data:"name"`
field string `data:"time,name,text"`
create string `name:"create name text" help:"创建"`
start string `name:"start server.port" help:"启动"`
field string `data:"time,name,path"`
create string `name:"create name path"`
start string `name:"start server.port"`
list string `name:"list name auto create order install" help:"服务框架"`
}
func (s spring) Order(m *ice.Message) {
s.Code.Order(m, "", ice.BIN)
}
func (s spring) Create(m *ice.Message, arg ...string) {
s.Hash.Create(m, arg...)
}
func (s spring) Build(m *ice.Message) {
s.Code.Stream(m, path.Join(ice.USR, m.Option(mdb.NAME)), "mvn", "package")
s.Code.Stream(m, m.Option(nfs.PATH), MVN, "package")
}
func (s spring) Start(m *ice.Message, arg ...string) {
args := []string{}
for i := 0; i < len(arg)-1; i += 2 {
args = append(args, "-D"+arg[i]+"="+arg[i+1])
}
s.Code.Daemon(m, path.Join(ice.USR, m.Option(mdb.NAME)), kit.Simple("java", args, "-jar", kit.Format("target/%s-0.0.1-SNAPSHOT.jar", m.Option(mdb.NAME)))...)
s.Code.Daemon(m, m.Option(nfs.PATH), kit.Simple(JAVA, kit.Simple(arg, func(k, v string) string { return "-D"+k+ice.EQ+v }),
"-jar", kit.Format("target/%s-0.0.1-SNAPSHOT.jar", m.Option(mdb.NAME)))...)
}
func (s spring) List(m *ice.Message, arg ...string) {
if len(arg) == 0 { // 项目列表
if len(arg) == 0 {
s.Hash.List(m, arg...).PushAction(s.Start, s.Build)
} else { // 服务列表
} else {
m.Cmd(cli.DAEMON).Table(func(index int, value ice.Maps, head []string) {
if strings.Contains(value[ice.CMD], "target/"+arg[0]+"-0.0.1-SNAPSHOT.jar") {
m.PushRecord(value, head...)
@ -52,5 +39,4 @@ func (s spring) List(m *ice.Message, arg ...string) {
})
}
}
func init() { ice.CodeCtxCmd(spring{}) }

View File

@ -13,7 +13,7 @@ const (
type compile struct {
ice.Code
regexp string `data:".*.js"`
regexp string `data:".*\.js$"`
linux string `data:"https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-linux-x64.tar.xz"`
darwin string `data:"https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-darwin-x64.tar.gz"`
list string `name:"list path auto xterm listScript order install" help:"编译器"`
@ -29,5 +29,4 @@ func (s compile) List(m *ice.Message, arg ...string) {
func (s compile) Xterm(m *ice.Message, arg ...string) {
s.Code.Xterm(m, []string{mdb.TYPE, NODE}, arg...)
}
func init() { ice.CodeCtxCmd(compile{}) }

View File

@ -9,4 +9,4 @@ field web.code.node.compile
shell `
wget https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-linux-x64.tar.xz
tar xvf node-v16.15.1-linux-x64.tar.xz && cd node-v16.15.1-linux-x64
`Á
`