Skip to content

Commit

Permalink
build-in app xiang -> yao
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Feb 14, 2022
1 parent 05f4596 commit 8daba92
Show file tree
Hide file tree
Showing 35 changed files with 377 additions and 291 deletions.
49 changes: 44 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ plugin-mac:
pack:
mkdir -p .tmp/data
cp -r ui .tmp/data/
cp -r xiang .tmp/data/
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data

Expand All @@ -123,7 +123,7 @@ artifacts-linux: clean
# Packing
mkdir -p .tmp/data
cp -r ../ui/dist .tmp/data/ui
cp -r xiang .tmp/data/
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui
Expand Down Expand Up @@ -151,22 +151,61 @@ artifacts-macos: clean
# Packing
mkdir -p .tmp/data
cp -r ../ui/dist .tmp/data/ui
cp -r xiang .tmp/data/
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui

# Making artifacts
mkdir -p dist
CGO_ENABLED=1 CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -o dist/yao-${VERSION}-darwin-amd64
CGO_ENABLED=1 CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -o dist/yao-${VERSION}-darwin-arm64
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -o dist/yao-${VERSION}-darwin-amd64
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -o dist/yao-${VERSION}-darwin-arm64

mkdir -p dist/release
mv dist/yao-*-* dist/release/
chmod +x dist/release/yao-*-*
ls -l dist/release/
dist/release/yao-${VERSION}-darwin-amd64 version

.PHONY: debug
debug: clean
mkdir -p dist/release

# Packing
mkdir -p .tmp/data
cp -r ui .tmp/data/ui
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data

# Making artifacts
mkdir -p dist
CGO_ENABLED=1 go build -v -o dist/release/yao-debug
chmod +x dist/release/yao-debug

.PHONY: release
release: clean
mkdir -p dist/release
mkdir .tmp

# Building UI
git clone https://github.com/YaoApp/xgen.git .tmp/ui
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/ui/public/icon/md_icon.css
cd .tmp/ui && npm install && npm run build

# Packing
mkdir -p .tmp/data
cp -r .tmp/ui/dist .tmp/data/ui
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui

# Making artifacts
mkdir -p dist
CGO_ENABLED=1 go build -v -o dist/release/yao
chmod +x dist/release/yao

# make clean
.PHONY: clean
clean:
Expand Down
24 changes: 12 additions & 12 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ func LoadInfo(root string) {
}
}

if fs.MustExists("/xiang/icons/icon.icns") {
info.Icons.Set("icns", xfs.Encode(fs.MustReadFile("/xiang/icons/icon.icns")))
if fs.MustExists("/yao/icons/icon.icns") {
info.Icons.Set("icns", xfs.Encode(fs.MustReadFile("/yao/icons/icon.icns")))
}

if fs.MustExists("/xiang/icons/icon.ico") {
info.Icons.Set("ico", xfs.Encode(fs.MustReadFile("/xiang/icons/icon.ico")))
if fs.MustExists("/yao/icons/icon.ico") {
info.Icons.Set("ico", xfs.Encode(fs.MustReadFile("/yao/icons/icon.ico")))
}

if fs.MustExists("/xiang/icons/icon.png") {
info.Icons.Set("png", xfs.Encode(fs.MustReadFile("/xiang/icons/icon.png")))
if fs.MustExists("/yao/icons/icon.png") {
info.Icons.Set("png", xfs.Encode(fs.MustReadFile("/yao/icons/icon.png")))
}

share.App = info
Expand All @@ -114,9 +114,9 @@ func LoadLang(cfg config.Config) error {

var defaults = []share.Script{}
if os.Getenv("YAO_DEV") != "" {
defaults = share.GetFilesFS(filepath.Join(os.Getenv("YAO_DEV"), "xiang"), ".json")
defaults = share.GetFilesFS(filepath.Join(os.Getenv("YAO_DEV"), "yao"), ".json")
} else {
defaults = share.GetFilesBin("xiang", ".json")
defaults = share.GetFilesBin("yao", ".json")
}

for _, lang := range defaults {
Expand Down Expand Up @@ -176,14 +176,14 @@ func defaultInfo() share.AppInfo {
info := share.AppInfo{
Icons: maps.MakeSync(),
}
err := jsoniter.Unmarshal(data.MustAsset("xiang/data/app.json"), &info)
err := jsoniter.Unmarshal(data.MustAsset("yao/data/app.json"), &info)
if err != nil {
exception.New("解析默认应用失败 %s", 500, err).Throw()
}

info.Icons.Set("icns", xfs.Encode(data.MustAsset("xiang/data/icons/icon.icns")))
info.Icons.Set("ico", xfs.Encode(data.MustAsset("xiang/data/icons/icon.ico")))
info.Icons.Set("png", xfs.Encode(data.MustAsset("xiang/data/icons/icon.png")))
info.Icons.Set("icns", xfs.Encode(data.MustAsset("yao/data/icons/icon.icns")))
info.Icons.Set("ico", xfs.Encode(data.MustAsset("yao/data/icons/icon.ico")))
info.Icons.Set("png", xfs.Encode(data.MustAsset("yao/data/icons/icon.png")))

return info
}
577 changes: 312 additions & 265 deletions data/bindata.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions engine/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Load(cfg config.Config) (err error) {

// 加载应用引擎
if os.Getenv("YAO_DEV") != "" {
LoadEngine(filepath.Join(os.Getenv("YAO_DEV"), "/xiang"))
LoadEngine(filepath.Join(os.Getenv("YAO_DEV"), "/yao"))
} else {
LoadEngine()
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func LoadEngine(from ...string) {
if len(from) > 0 {
scripts = share.GetFilesFS(from[0], ".json")
} else {
scripts = share.GetFilesBin("xiang", ".json")
scripts = share.GetFilesBin("yao", ".json")
}

if scripts == nil {
Expand Down
2 changes: 1 addition & 1 deletion engine/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestLoad(t *testing.T) {
// 从文件系统载入引擎文件
func TestLoadEngineFS(t *testing.T) {
defer Load(config.Conf)
root := path.Join(os.Getenv("YAO_DEV"), "/xiang")
root := path.Join(os.Getenv("YAO_DEV"), "/yao")
assert.NotPanics(t, func() {
LoadEngine(root)
})
Expand Down
2 changes: 1 addition & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Xiang Admin
Yao web services mode
2 changes: 1 addition & 1 deletion workflow/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func init() {
share.DBConnect(config.Conf.DB)
share.Load(config.Conf)
model.Load(config.Conf)
engineModels := path.Join(os.Getenv("YAO_DEV"), "xiang", "models")
engineModels := path.Join(os.Getenv("YAO_DEV"), "yao", "models")
model.LoadFrom(engineModels, "xiang.")
query.Load(config.Conf)
flow.Load(config.Conf)
Expand Down
Binary file removed xiang/data/icons/icon.icns
Binary file not shown.
Binary file removed xiang/data/icons/icon.ico
Binary file not shown.
Binary file removed xiang/data/icons/icon.png
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion xiang/apis/chart.http.json → yao/apis/chart.http.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "数据分析接口API",
"group": "xiang/chart",
"guard": "in-process",
"guard": "bearer-jwt",
"paths": [
{
"path": "/:name/data",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion xiang/apis/page.http.json → yao/apis/page.http.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "页面接口API",
"group": "xiang/page",
"guard": "in-process",
"guard": "bearer-jwt",
"paths": [
{
"path": "/:name/data",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Binary file added yao/data/icons/icon.icns
Binary file not shown.
Binary file added yao/data/icons/icon.ico
Binary file not shown.
Binary file added yao/data/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions xiang/data/index.html → yao/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>象传智慧 | iqka.com</title>
<title>Yao App Engine</title>
</head>
<body class="overscroll-none">
It works! <a href="https://www.iqka.com"> 象传应用引擎官网 </a>
It works! <a href="https://yaoapps.com"> Yao App Engine </a>
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8daba92

Please sign in to comment.