去掉data目录

pull/21/merge
ouqiang 2017-04-25 17:22:54 +08:00
parent 30039c7f08
commit ce5cc5533e
6 changed files with 18 additions and 10 deletions

View File

@ -9,5 +9,5 @@
```
可选参数
+ -p 端口, 指定端口, 默认5920
+ -d 后台运行 (不支持Windows)
+ -e 指定运行环境, dev|test|prod, dev模式下可查看更多日志信息, 默认prod
+ -h 查看帮助

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash
# todo 删除调试代码
set -x -u
# set -x -u
# 构建应用, 生成压缩包 gocron.zip或gocron.tar.gz
# 使用方式 -p 指定平台(widows linux darwin) -a 指定体系架构(amd64 386), 默认amd64
# ./build.sh -p windows -a amd64
TEMP_DIR=`date +%s`-temp-`echo $RANDOM`

View File

@ -1,6 +1,8 @@
package models
import "errors"
import (
"errors"
)
// 创建数据库表
@ -14,7 +16,14 @@ func (migration *Migration) Exec(dbName string) error {
&User{}, &Task{}, &TaskLog{}, &Host{},
}
for _, table := range tables {
err := Db.Sync2(table)
exist, err:= Db.IsTableExist(table)
if exist {
return errors.New("数据表已存在")
}
if err != nil {
return err
}
err = Db.Sync2(table)
if err != nil {
return err
}

View File

@ -14,7 +14,6 @@ var (
AppDir string // 应用根目录
ConfDir string // 配置目录
LogDir string // 日志目录
DataDir string // 数据目录存放session文件等
AppConfig string // 应用配置文件
Installed bool // 应用是否安装过
)
@ -29,9 +28,8 @@ func InitEnv() {
AppDir = wd
ConfDir = AppDir + "/conf"
LogDir = AppDir + "/log"
DataDir = AppDir + "/data"
AppConfig = ConfDir + "/app.ini"
checkDirExists(ConfDir, LogDir, DataDir)
checkDirExists(ConfDir, LogDir)
Installed = IsInstalled()
if Installed {
InitDb()

View File

@ -9,6 +9,7 @@ import (
"strconv"
"github.com/ouqiang/gocron/modules/logger"
"github.com/go-macaron/binding"
"fmt"
)
// 系统安装
@ -60,7 +61,7 @@ func Store(ctx *macaron.Context, form InstallForm) string {
migration := new(models.Migration)
err = migration.Exec(form.DbName)
if err != nil {
return json.CommonFailure("创建数据库表失败", err)
return json.CommonFailure(fmt.Sprintf("创建数据库表失败-%s", err.Error()), err)
}
// 创建管理员账号

View File

@ -44,7 +44,7 @@
</div>
</div>
</label>
<div class="ui small left icon input">
<div class="ui small input">
<input type="text" name="spec" value="{{{.Task.Spec}}}" />
</div>
</div>