[add] http.* processes & http JSAPI
This commit is contained in:
parent
e0257b5ad1
commit
507d39e011
25 changed files with 82 additions and 14 deletions
4
.github/workflows/release-linux.yml
vendored
4
.github/workflows/release-linux.yml
vendored
|
|
@ -69,13 +69,13 @@ jobs:
|
||||||
- name: Checkout XGen v0.9
|
- name: Checkout XGen v0.9
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/xgen
|
repository: yaoapp/xgen-deprecated
|
||||||
path: xgen-v0.9
|
path: xgen-v0.9
|
||||||
|
|
||||||
- name: Checkout XGen v1.0
|
- name: Checkout XGen v1.0
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/xgen-next
|
repository: yaoapp/xgen
|
||||||
# ref: 9ce17a22904b3f09de90f08abbbdaf42f6b0ef68
|
# ref: 9ce17a22904b3f09de90f08abbbdaf42f6b0ef68
|
||||||
path: xgen-v1.0
|
path: xgen-v1.0
|
||||||
|
|
||||||
|
|
|
||||||
4
.github/workflows/release-macos.yml
vendored
4
.github/workflows/release-macos.yml
vendored
|
|
@ -61,13 +61,13 @@ jobs:
|
||||||
- name: Checkout XGen v0.9
|
- name: Checkout XGen v0.9
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/xgen
|
repository: yaoapp/xgen-deprecated
|
||||||
path: xgen-v0.9
|
path: xgen-v0.9
|
||||||
|
|
||||||
- name: Checkout XGen v1.0
|
- name: Checkout XGen v1.0
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/xgen-next
|
repository: yaoapp/xgen
|
||||||
# ref: 9ce17a22904b3f09de90f08abbbdaf42f6b0ef68
|
# ref: 9ce17a22904b3f09de90f08abbbdaf42f6b0ef68
|
||||||
path: xgen-v1.0
|
path: xgen-v1.0
|
||||||
|
|
||||||
|
|
|
||||||
6
Makefile
6
Makefile
|
|
@ -273,7 +273,7 @@ release: clean
|
||||||
|
|
||||||
# Building XGEN v1.0
|
# Building XGEN v1.0
|
||||||
export NODE_ENV=production
|
export NODE_ENV=production
|
||||||
git clone https://github.com/YaoApp/xgen-next.git .tmp/xgen/v1.0
|
git clone https://github.com/YaoApp/xgen.git .tmp/xgen/v1.0
|
||||||
# cd .tmp/xgen/v1.0 && git checkout 9ce17a22904b3f09de90f08abbbdaf42f6b0ef68
|
# cd .tmp/xgen/v1.0 && git checkout 9ce17a22904b3f09de90f08abbbdaf42f6b0ef68
|
||||||
echo "BASE=__yao_admin_root" > .tmp/xgen/v1.0/packages/xgen/.env
|
echo "BASE=__yao_admin_root" > .tmp/xgen/v1.0/packages/xgen/.env
|
||||||
cd .tmp/xgen/v1.0 && pnpm install && pnpm run build
|
cd .tmp/xgen/v1.0 && pnpm install && pnpm run build
|
||||||
|
|
@ -310,7 +310,7 @@ linux-release: clean
|
||||||
mkdir .tmp
|
mkdir .tmp
|
||||||
|
|
||||||
# Building XGEN v0.9
|
# Building XGEN v0.9
|
||||||
git clone https://github.com/YaoApp/xgen.git .tmp/xgen/v0.9
|
git clone https://github.com/YaoApp/xgen-deprecated.git .tmp/xgen/v0.9
|
||||||
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/xgen/v0.9/public/icon/md_icon.css
|
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/xgen/v0.9/public/icon/md_icon.css
|
||||||
cd .tmp/xgen/v0.9 && yarn install && yarn build
|
cd .tmp/xgen/v0.9 && yarn install && yarn build
|
||||||
mkdir -p .tmp/xgen/v0.9
|
mkdir -p .tmp/xgen/v0.9
|
||||||
|
|
@ -318,7 +318,7 @@ linux-release: clean
|
||||||
|
|
||||||
# Building XGEN v1.0
|
# Building XGEN v1.0
|
||||||
export NODE_ENV=production
|
export NODE_ENV=production
|
||||||
git clone https://github.com/YaoApp/xgen-next.git .tmp/xgen/v1.0
|
git clone https://github.com/YaoApp/xgen.git .tmp/xgen/v1.0
|
||||||
rm -f .tmp/xgen/v1.0/pnpm-lock.yaml
|
rm -f .tmp/xgen/v1.0/pnpm-lock.yaml
|
||||||
echo "BASE=__yao_admin_root" > .tmp/xgen/v1.0/packages/xgen/.env
|
echo "BASE=__yao_admin_root" > .tmp/xgen/v1.0/packages/xgen/.env
|
||||||
cd .tmp/xgen/v1.0 && pnpm install && pnpm run build
|
cd .tmp/xgen/v1.0 && pnpm install && pnpm run build
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,12 @@ import (
|
||||||
_ "github.com/yaoapp/yao/helper"
|
_ "github.com/yaoapp/yao/helper"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
"github.com/yaoapp/yao/query"
|
"github.com/yaoapp/yao/query"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB)
|
share.DBConnect(config.Conf.DB)
|
||||||
model.Load(config.Conf)
|
model.Load(config.Conf)
|
||||||
query.Load(config.Conf)
|
query.Load(config.Conf)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"github.com/yaoapp/yao/page"
|
"github.com/yaoapp/yao/page"
|
||||||
"github.com/yaoapp/yao/plugin"
|
"github.com/yaoapp/yao/plugin"
|
||||||
"github.com/yaoapp/yao/query"
|
"github.com/yaoapp/yao/query"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/schedule"
|
"github.com/yaoapp/yao/schedule"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
|
|
@ -40,6 +41,12 @@ import (
|
||||||
func Load(cfg config.Config) (err error) {
|
func Load(cfg config.Config) (err error) {
|
||||||
defer func() { err = exception.Catch(recover()) }()
|
defer func() { err = exception.Catch(recover()) }()
|
||||||
|
|
||||||
|
// Load Runtime
|
||||||
|
err = runtime.Load(cfg)
|
||||||
|
if err != nil {
|
||||||
|
printErr(cfg.Mode, "Runtime", err)
|
||||||
|
}
|
||||||
|
|
||||||
// 加载应用信息
|
// 加载应用信息
|
||||||
// 第一步: 加载应用信息
|
// 第一步: 加载应用信息
|
||||||
app.Load(cfg)
|
app.Load(cfg)
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
gou.Flows = make(map[string]*gou.Flow)
|
gou.Flows = make(map[string]*gou.Flow)
|
||||||
Load(config.Conf)
|
Load(config.Conf)
|
||||||
LoadFrom("not a path", "404.")
|
LoadFrom("not a path", "404.")
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/flow"
|
"github.com/yaoapp/yao/flow"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -35,6 +37,7 @@ func TestProcessHexToStringInFlow(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProcessHexToStringInScript(t *testing.T) {
|
func TestProcessHexToStringInScript(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
testscirpt := path.Join(os.Getenv("YAO_DEV"), "tests", "scripts")
|
testscirpt := path.Join(os.Getenv("YAO_DEV"), "tests", "scripts")
|
||||||
share.LoadFrom(testscirpt)
|
share.LoadFrom(testscirpt)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,13 @@ import (
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
"github.com/yaoapp/yao/query"
|
"github.com/yaoapp/yao/query"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB)
|
share.DBConnect(config.Conf.DB)
|
||||||
model.Load(config.Conf)
|
model.Load(config.Conf)
|
||||||
query.Load(config.Conf)
|
query.Load(config.Conf)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
package network
|
package network
|
||||||
|
|
||||||
|
// *******************************************************
|
||||||
|
// * DEPRECATED → http *
|
||||||
|
// *******************************************************
|
||||||
|
|
||||||
import "github.com/yaoapp/gou"
|
import "github.com/yaoapp/gou"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
package network
|
package network
|
||||||
|
|
||||||
|
// *******************************************************
|
||||||
|
// * DEPRECATED → http *
|
||||||
|
// *******************************************************
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@ import (
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// *******************************************************
|
||||||
|
// * DEPRECATED → http *
|
||||||
|
// *******************************************************
|
||||||
|
|
||||||
// ProcessPost xiang.helper.Post HTTP Post
|
// ProcessPost xiang.helper.Post HTTP Post
|
||||||
func ProcessPost(process *gou.Process) interface{} {
|
func ProcessPost(process *gou.Process) interface{} {
|
||||||
process.ValidateArgNums(1)
|
process.ValidateArgNums(1)
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ import (
|
||||||
_ "github.com/yaoapp/yao/helper"
|
_ "github.com/yaoapp/yao/helper"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
"github.com/yaoapp/yao/query"
|
"github.com/yaoapp/yao/query"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB)
|
share.DBConnect(config.Conf.DB)
|
||||||
model.Load(config.Conf)
|
model.Load(config.Conf)
|
||||||
query.Load(config.Conf)
|
query.Load(config.Conf)
|
||||||
|
|
|
||||||
18
runtime/runtime.go
Normal file
18
runtime/runtime.go
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/yaoapp/gou"
|
||||||
|
"github.com/yaoapp/gou/runtime"
|
||||||
|
"github.com/yaoapp/yao/config"
|
||||||
|
"github.com/yaoapp/yao/fs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Load runtime
|
||||||
|
func Load(cfg config.Config) error {
|
||||||
|
dataRoot, err := fs.Root(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
gou.LoadRuntime(runtime.Option{FileRoot: dataRoot})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -7,9 +7,12 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
|
"github.com/yaoapp/yao/config"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
rootLib := path.Join(os.Getenv("YAO_DEV"), "/tests/scripts")
|
rootLib := path.Join(os.Getenv("YAO_DEV"), "/tests/scripts")
|
||||||
LoadFrom(rootLib, "")
|
LoadFrom(rootLib, "")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,14 @@ import (
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/helper"
|
"github.com/yaoapp/yao/helper"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type kv map[string]interface{}
|
type kv map[string]interface{}
|
||||||
type arr []interface{}
|
type arr []interface{}
|
||||||
|
|
||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
err := Load(config.Conf)
|
err := Load(config.Conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,13 @@ import (
|
||||||
_ "github.com/yaoapp/yao/helper"
|
_ "github.com/yaoapp/yao/helper"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
"github.com/yaoapp/yao/query"
|
"github.com/yaoapp/yao/query"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB)
|
share.DBConnect(config.Conf.DB)
|
||||||
model.Load(config.Conf)
|
model.Load(config.Conf)
|
||||||
share.Load(config.Conf)
|
share.Load(config.Conf)
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,19 @@ import (
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
"github.com/yaoapp/gou/websocket"
|
"github.com/yaoapp/gou/websocket"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
Load(config.Conf)
|
Load(config.Conf)
|
||||||
LoadFrom("not a path", "404.")
|
LoadFrom("not a path", "404.")
|
||||||
check(t)
|
check(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWebSocketOpen(t *testing.T) {
|
func TestWebSocketOpen(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
Load(config.Conf)
|
Load(config.Conf)
|
||||||
script.Load(config.Conf)
|
script.Load(config.Conf)
|
||||||
srv, url := serve(t)
|
srv, url := serve(t)
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,12 @@ import (
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
"github.com/yaoapp/kun/any"
|
"github.com/yaoapp/kun/any"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB) // 创建数据库连接
|
share.DBConnect(config.Conf.DB) // 创建数据库连接
|
||||||
Load(config.Conf)
|
Load(config.Conf)
|
||||||
LoadFrom("not a path")
|
LoadFrom("not a path")
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/flow"
|
"github.com/yaoapp/yao/flow"
|
||||||
"github.com/yaoapp/yao/i18n"
|
"github.com/yaoapp/yao/i18n"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/widgets/login"
|
"github.com/yaoapp/yao/widgets/login"
|
||||||
)
|
)
|
||||||
|
|
@ -274,6 +275,7 @@ func TestProcessService(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadApp(t *testing.T) {
|
func loadApp(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
|
|
||||||
err := script.Load(config.Conf)
|
err := script.Load(config.Conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/i18n"
|
"github.com/yaoapp/yao/i18n"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
@ -21,7 +22,7 @@ func TestLoad(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepare(t *testing.T, language ...string) {
|
func prepare(t *testing.T, language ...string) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
i18n.Load(config.Conf)
|
i18n.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB) // removed later
|
share.DBConnect(config.Conf.DB) // removed later
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/i18n"
|
"github.com/yaoapp/yao/i18n"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
"github.com/yaoapp/yao/table"
|
"github.com/yaoapp/yao/table"
|
||||||
|
|
@ -24,7 +25,7 @@ func TestLoad(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepare(t *testing.T, language ...string) {
|
func prepare(t *testing.T, language ...string) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
i18n.Load(config.Conf)
|
i18n.Load(config.Conf)
|
||||||
|
|
||||||
share.DBConnect(config.Conf.DB) // removed later
|
share.DBConnect(config.Conf.DB) // removed later
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@ import (
|
||||||
"github.com/yaoapp/gou"
|
"github.com/yaoapp/gou"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/i18n"
|
"github.com/yaoapp/yao/i18n"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
i18n.Load(config.Conf)
|
i18n.Load(config.Conf)
|
||||||
err := Load(config.Conf)
|
err := Load(config.Conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -43,7 +44,7 @@ func TestLoad(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadHK(t *testing.T) {
|
func TestLoadHK(t *testing.T) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
i18n.Load(config.Conf)
|
i18n.Load(config.Conf)
|
||||||
err := Load(config.Conf)
|
err := Load(config.Conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/flow"
|
"github.com/yaoapp/yao/flow"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/widgets/app"
|
"github.com/yaoapp/yao/widgets/app"
|
||||||
"github.com/yaoapp/yao/widgets/component"
|
"github.com/yaoapp/yao/widgets/component"
|
||||||
|
|
@ -34,7 +35,7 @@ func TestLoadID(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepare(t *testing.T, language ...string) {
|
func prepare(t *testing.T, language ...string) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
err := test.LoadEngine(language...)
|
err := test.LoadEngine(language...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,13 @@ import (
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/i18n"
|
"github.com/yaoapp/yao/i18n"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoadEngine load engine
|
// LoadEngine load engine
|
||||||
func LoadEngine(language ...string) error {
|
func LoadEngine(language ...string) error {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
i18n.Load(config.Conf)
|
i18n.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB) // removed later
|
share.DBConnect(config.Conf.DB) // removed later
|
||||||
gou.LoadCrypt(`{}`, "PASSWORD")
|
gou.LoadCrypt(`{}`, "PASSWORD")
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/i18n"
|
"github.com/yaoapp/yao/i18n"
|
||||||
"github.com/yaoapp/yao/model"
|
"github.com/yaoapp/yao/model"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/script"
|
"github.com/yaoapp/yao/script"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
@ -18,7 +19,7 @@ func TestLoad(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepare(t *testing.T, language ...string) {
|
func prepare(t *testing.T, language ...string) {
|
||||||
|
runtime.Load(config.Conf)
|
||||||
i18n.Load(config.Conf)
|
i18n.Load(config.Conf)
|
||||||
share.DBConnect(config.Conf.DB) // removed later
|
share.DBConnect(config.Conf.DB) // removed later
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue