目录结构调整

develop
ouqiang 2018-03-25 13:12:12 +08:00
parent 32caa5a4b7
commit b10cff294c
123 changed files with 101 additions and 93 deletions

View File

@ -7,12 +7,12 @@ import (
"os/signal"
"syscall"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/app"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/setting"
"github.com/ouqiang/gocron/routers"
"github.com/ouqiang/gocron/service"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/app"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/setting"
"github.com/ouqiang/gocron/internal/routers"
"github.com/ouqiang/gocron/internal/service"
"github.com/urfave/cli"
"gopkg.in/macaron.v1"
)

View File

@ -9,9 +9,9 @@ import (
"runtime"
"strings"
"github.com/ouqiang/gocron/modules/rpc/auth"
"github.com/ouqiang/gocron/modules/rpc/server"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/modules/rpc/auth"
"github.com/ouqiang/gocron/internal/modules/rpc/server"
"github.com/ouqiang/gocron/internal/modules/utils"
)
var AppVersion = "1.4"

View File

@ -6,7 +6,7 @@ import (
"strconv"
"github.com/go-xorm/xorm"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/internal/modules/logger"
)
type Migration struct{}

View File

@ -8,9 +8,9 @@ import (
_ "github.com/go-sql-driver/mysql"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm"
"github.com/ouqiang/gocron/modules/app"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/setting"
"github.com/ouqiang/gocron/internal/modules/app"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/setting"
"gopkg.in/macaron.v1"
)

View File

@ -3,7 +3,7 @@ package models
import (
"time"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/modules/utils"
)
const PasswordSaltLength = 6

View File

@ -8,9 +8,9 @@ import (
"strconv"
"strings"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/setting"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/setting"
"github.com/ouqiang/gocron/internal/modules/utils"
)
var (

View File

@ -6,9 +6,9 @@ import (
"time"
"github.com/go-gomail/gomail"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
)
// @author qiang.ou<qingqianludao@gmail.com>

View File

@ -4,7 +4,7 @@ import (
"fmt"
"time"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/internal/modules/logger"
)
type Message map[string]interface{}

View File

@ -8,10 +8,10 @@ import (
"strings"
"time"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/httpclient"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/httpclient"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
)
type Slack struct{}

View File

@ -6,9 +6,9 @@ import (
"sync"
"time"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/rpc/grpcpool"
pb "github.com/ouqiang/gocron/modules/rpc/proto"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/rpc/grpcpool"
pb "github.com/ouqiang/gocron/internal/modules/rpc/proto"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"

View File

@ -6,8 +6,8 @@ import (
"sync"
"time"
"github.com/ouqiang/gocron/modules/app"
"github.com/ouqiang/gocron/modules/rpc/auth"
"github.com/ouqiang/gocron/internal/modules/app"
"github.com/ouqiang/gocron/internal/modules/rpc/auth"
"github.com/silenceper/pool"
"google.golang.org/grpc"
)

View File

@ -3,9 +3,9 @@ package server
import (
"net"
"github.com/ouqiang/gocron/modules/rpc/auth"
pb "github.com/ouqiang/gocron/modules/rpc/proto"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/modules/rpc/auth"
pb "github.com/ouqiang/gocron/internal/modules/rpc/proto"
"github.com/ouqiang/gocron/internal/modules/utils"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"

View File

@ -3,8 +3,8 @@ package setting
import (
"errors"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
"gopkg.in/ini.v1"
)

View File

@ -3,7 +3,7 @@ package utils
import (
"encoding/json"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/internal/modules/logger"
)
// json 格式输出

View File

@ -1,7 +1,7 @@
package base
import (
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/internal/models"
"gopkg.in/macaron.v1"
)

View File

@ -8,14 +8,14 @@ import (
"github.com/Unknwon/paginater"
"github.com/go-macaron/binding"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/rpc/client"
"github.com/ouqiang/gocron/modules/rpc/grpcpool"
"github.com/ouqiang/gocron/modules/rpc/proto"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/routers/base"
"github.com/ouqiang/gocron/service"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/rpc/client"
"github.com/ouqiang/gocron/internal/modules/rpc/grpcpool"
"github.com/ouqiang/gocron/internal/modules/rpc/proto"
"github.com/ouqiang/gocron/internal/modules/utils"
"github.com/ouqiang/gocron/internal/routers/base"
"github.com/ouqiang/gocron/internal/service"
"gopkg.in/macaron.v1"
)

View File

@ -5,11 +5,11 @@ import (
"strconv"
"github.com/go-macaron/binding"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/app"
"github.com/ouqiang/gocron/modules/setting"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/service"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/app"
"github.com/ouqiang/gocron/internal/modules/setting"
"github.com/ouqiang/gocron/internal/modules/utils"
"github.com/ouqiang/gocron/internal/service"
"gopkg.in/macaron.v1"
)

View File

@ -5,9 +5,9 @@ import (
"html/template"
"github.com/Unknwon/paginater"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/routers/base"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/routers/base"
"gopkg.in/macaron.v1"
)

View File

@ -3,9 +3,9 @@ package manage
import (
"encoding/json"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
"gopkg.in/macaron.v1"
)

View File

@ -13,21 +13,22 @@ import (
"github.com/go-macaron/gzip"
"github.com/go-macaron/session"
"github.com/go-macaron/toolbox"
"github.com/ouqiang/gocron/modules/app"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/routers/host"
"github.com/ouqiang/gocron/routers/install"
"github.com/ouqiang/gocron/routers/loginlog"
"github.com/ouqiang/gocron/routers/manage"
"github.com/ouqiang/gocron/routers/task"
"github.com/ouqiang/gocron/routers/tasklog"
"github.com/ouqiang/gocron/routers/user"
"github.com/ouqiang/gocron/internal/modules/app"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
"github.com/ouqiang/gocron/internal/routers/host"
"github.com/ouqiang/gocron/internal/routers/install"
"github.com/ouqiang/gocron/internal/routers/loginlog"
"github.com/ouqiang/gocron/internal/routers/manage"
"github.com/ouqiang/gocron/internal/routers/task"
"github.com/ouqiang/gocron/internal/routers/tasklog"
"github.com/ouqiang/gocron/internal/routers/user"
"gopkg.in/macaron.v1"
)
// 静态文件目录
const StaticDir = "public"
const staticDir = "web/public"
const templateDir = "web/templates"
// 路由注册
func Register(m *macaron.Macaron) {
@ -141,8 +142,9 @@ func RegisterMiddleware(m *macaron.Macaron) {
if macaron.Env != macaron.DEV {
m.Use(gzip.Gziper())
}
m.Use(macaron.Static(StaticDir))
m.Use(macaron.Static(staticDir))
m.Use(macaron.Renderer(macaron.RenderOptions{
Directory: templateDir,
// 模板语法分隔符,默认为 ["{{", "}}"]
Delims: macaron.Delims{"{%", "%}"},
Funcs: []template.FuncMap{map[string]interface{}{

View File

@ -9,11 +9,11 @@ import (
"github.com/Unknwon/paginater"
"github.com/go-macaron/binding"
"github.com/jakecoffman/cron"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/routers/base"
"github.com/ouqiang/gocron/service"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
"github.com/ouqiang/gocron/internal/routers/base"
"github.com/ouqiang/gocron/internal/service"
"gopkg.in/macaron.v1"
)

View File

@ -7,11 +7,11 @@ import (
"html/template"
"github.com/Unknwon/paginater"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/routers/base"
"github.com/ouqiang/gocron/service"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
"github.com/ouqiang/gocron/internal/routers/base"
"github.com/ouqiang/gocron/internal/service"
"gopkg.in/macaron.v1"
)

View File

@ -8,10 +8,10 @@ import (
"github.com/Unknwon/paginater"
"github.com/go-macaron/captcha"
"github.com/go-macaron/session"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/routers/base"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/utils"
"github.com/ouqiang/gocron/internal/routers/base"
"gopkg.in/macaron.v1"
)

View File

@ -10,13 +10,13 @@ import (
"time"
"github.com/jakecoffman/cron"
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/modules/app"
"github.com/ouqiang/gocron/modules/httpclient"
"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/modules/notify"
rpcClient "github.com/ouqiang/gocron/modules/rpc/client"
pb "github.com/ouqiang/gocron/modules/rpc/proto"
"github.com/ouqiang/gocron/internal/models"
"github.com/ouqiang/gocron/internal/modules/app"
"github.com/ouqiang/gocron/internal/modules/httpclient"
"github.com/ouqiang/gocron/internal/modules/logger"
"github.com/ouqiang/gocron/internal/modules/notify"
rpcClient "github.com/ouqiang/gocron/internal/modules/rpc/client"
pb "github.com/ouqiang/gocron/internal/modules/rpc/proto"
)
var (

View File

@ -1,17 +1,21 @@
all: build
default: build
.PHONY: build
build: gocron node
.PHONY: gocron
gocron:
go build -o bin/gocron ./cmd/gocron
.PHONY: node
node:
go build -o bin/gocron-node ./cmd/node
.PHONY: clean
clean:
rm bin/gocron

View File

@ -2,18 +2,20 @@
LDFLAGS = -w -s -X main.AppVersion=${VERSION}
all: build
default: build
.PHONY: build
build: gocron node
.PHONY: gocron
gocron:
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./gocron_darwin_amd64/gocron ./cmd/gocron
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./gocron_linux_amd64/gocron ./cmd/gocron
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./gocron_windows_amd64/gocron.exe ./cmd/gocron
.PHONY: node
node:
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./gocron-node_darwin_amd64/gocron-node ./cmd/node

View File

@ -46,7 +46,7 @@ package_gocron() {
mkdir ${PACKAGE_DIR}/${PLATFORM_NAME}
fi
for file in public templates LICENSE README.md Dockerfile-release; do
for file in web LICENSE README.md Dockerfile-release; do
cp -r ${file} ${PLATFORM_NAME}
done

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 193 KiB

View File

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 210 KiB

After

Width:  |  Height:  |  Size: 210 KiB

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 416 B

View File

Before

Width:  |  Height:  |  Size: 530 B

After

Width:  |  Height:  |  Size: 530 B

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 236 B

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Some files were not shown because too many files have changed in this diff Show More