Skip to content

Commit

Permalink
目录结构调整
Browse files Browse the repository at this point in the history
  • Loading branch information
ouqiang committed Mar 25, 2018
1 parent 32caa5a commit b10cff2
Show file tree
Hide file tree
Showing 123 changed files with 101 additions and 93 deletions.
12 changes: 6 additions & 6 deletions cmd/gocron/gocron.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion models/migration.go → internal/models/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
6 changes: 3 additions & 3 deletions models/model.go → internal/models/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion models/user.go → internal/models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package models
import (
"time"

"github.com/ouqiang/gocron/modules/utils"
"github.com/ouqiang/gocron/internal/modules/utils"
)

const PasswordSaltLength = 6
Expand Down
6 changes: 3 additions & 3 deletions modules/app/app.go → internal/modules/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions modules/notify/mail.go → internal/modules/notify/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
8 changes: 4 additions & 4 deletions modules/notify/slack.go → internal/modules/notify/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion modules/utils/json.go → internal/modules/utils/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package utils
import (
"encoding/json"

"github.com/ouqiang/gocron/modules/logger"
"github.com/ouqiang/gocron/internal/modules/logger"
)

// json 格式输出
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion routers/base/base.go → internal/routers/base/base.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package base

import (
"github.com/ouqiang/gocron/models"
"github.com/ouqiang/gocron/internal/models"
"gopkg.in/macaron.v1"
)

Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions routers/host/host.go → internal/routers/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
26 changes: 14 additions & 12 deletions routers/routers.go → internal/routers/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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{}{
Expand Down
10 changes: 5 additions & 5 deletions routers/task/task.go → internal/routers/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
8 changes: 4 additions & 4 deletions routers/user/user.go → internal/routers/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
14 changes: 7 additions & 7 deletions service/task.go → internal/service/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
6 changes: 5 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit b10cff2

Please sign in to comment.