mirror of
https://github.com/beego/bee.git
synced 2024-11-23 11:50:55 +00:00
Merge branch 'develop' of https://github.com/beego/bee into develop
This commit is contained in:
commit
09324b884b
@ -7,7 +7,7 @@ Bee is a command line tool facilitating development with beego framework.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Go version >= 1.1.
|
||||
- Go version >= 1.3.
|
||||
|
||||
|
||||
## Installation
|
||||
|
2
fix.go
2
fix.go
@ -12,7 +12,7 @@ import (
|
||||
|
||||
var cmdFix = &Command{
|
||||
UsageLine: "fix",
|
||||
Short: "fix the beego application to compatibel with beego 1.6",
|
||||
Short: "fix the beego application to make it compatible with beego 1.6",
|
||||
Long: `
|
||||
As from beego1.6, there's some incompatible code with the old version.
|
||||
|
||||
|
13
g_appcode.go
13
g_appcode.go
@ -519,7 +519,9 @@ func (*MysqlDB) GetGoDataType(sqlType string) (goType string) {
|
||||
func (*PostgresDB) GetTableNames(db *sql.DB) (tables []string) {
|
||||
rows, err := db.Query(`
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_catalog = current_database() and table_schema = 'public'`)
|
||||
WHERE table_catalog = current_database() AND
|
||||
table_type = 'BASE TABLE' AND
|
||||
table_schema NOT IN ('pg_catalog', 'information_schema')`)
|
||||
if err != nil {
|
||||
ColorLog("[ERRO] Could not show tables: %s\n", err)
|
||||
ColorLog("[HINT] Check your connection string\n")
|
||||
@ -554,8 +556,10 @@ func (*PostgresDB) GetConstraints(db *sql.DB, table *Table, blackList map[string
|
||||
INNER JOIN
|
||||
information_schema.constraint_column_usage cu ON cu.constraint_name = c.constraint_name
|
||||
WHERE
|
||||
c.table_catalog = current_database() AND c.table_schema = 'public' AND c.table_name = $1
|
||||
AND u.table_catalog = current_database() AND u.table_schema = 'public' AND u.table_name = $2`,
|
||||
c.table_catalog = current_database() AND c.table_schema NOT IN ('pg_catalog', 'information_schema')
|
||||
AND c.table_name = $1
|
||||
AND u.table_catalog = current_database() AND u.table_schema NOT IN ('pg_catalog', 'information_schema')
|
||||
AND u.table_name = $2`,
|
||||
table.Name, table.Name) // u.position_in_unique_constraint,
|
||||
if err != nil {
|
||||
ColorLog("[ERRO] Could not query INFORMATION_SCHEMA for PK/UK/FK information: %s\n", err)
|
||||
@ -611,7 +615,8 @@ func (postgresDB *PostgresDB) GetColumns(db *sql.DB, table *Table, blackList map
|
||||
FROM
|
||||
information_schema.columns
|
||||
WHERE
|
||||
table_catalog = current_database() AND table_schema = 'public' AND table_name = $1`,
|
||||
table_catalog = current_database() AND table_schema NOT IN ('pg_catalog', 'information_schema')
|
||||
AND table_name = $1`,
|
||||
table.Name)
|
||||
defer colDefRows.Close()
|
||||
for colDefRows.Next() {
|
||||
|
@ -395,10 +395,13 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat
|
||||
tmp = make([]rune, 0)
|
||||
j += 1
|
||||
start = false
|
||||
if j == 1 {
|
||||
continue
|
||||
} else {
|
||||
st[j] = strings.TrimSpace(ss[i+1:])
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
start = true
|
||||
|
6
run.go
6
run.go
@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
var cmdRun = &Command{
|
||||
UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-e=Godeps -e=folderToExclude]",
|
||||
UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-e=Godeps -e=folderToExclude] [-tags=goBuildTags]",
|
||||
Short: "run the app and start a Web server for development",
|
||||
Long: `
|
||||
Run command will supervise the file system of the beego project using inotify,
|
||||
@ -43,12 +43,16 @@ var gendoc docValue
|
||||
// The flags list of the paths excluded from watching
|
||||
var excludedPaths strFlags
|
||||
|
||||
// Pass through to -tags arg of "go build"
|
||||
var buildTags string
|
||||
|
||||
func init() {
|
||||
cmdRun.Run = runApp
|
||||
cmdRun.Flag.Var(&mainFiles, "main", "specify main go files")
|
||||
cmdRun.Flag.Var(&gendoc, "gendoc", "auto generate the docs")
|
||||
cmdRun.Flag.Var(&downdoc, "downdoc", "auto download swagger file when not exist")
|
||||
cmdRun.Flag.Var(&excludedPaths, "e", "Excluded paths[].")
|
||||
cmdRun.Flag.StringVar(&buildTags, "tags", "", "Build tags (https://golang.org/pkg/go/build/)")
|
||||
}
|
||||
|
||||
var appname string
|
||||
|
7
watch.go
7
watch.go
@ -136,6 +136,7 @@ func Autobuild(files []string, isgenerate bool) {
|
||||
icmd := exec.Command("go", "list", "./...")
|
||||
buf := bytes.NewBuffer([]byte(""))
|
||||
icmd.Stdout = buf
|
||||
icmd.Env = append(os.Environ(), "GOGC=off")
|
||||
err = icmd.Run()
|
||||
if err == nil {
|
||||
list := strings.Split(buf.String(), "\n")[1:]
|
||||
@ -146,6 +147,7 @@ func Autobuild(files []string, isgenerate bool) {
|
||||
icmd = exec.Command(cmdName, "install", pkg)
|
||||
icmd.Stdout = os.Stdout
|
||||
icmd.Stderr = os.Stderr
|
||||
icmd.Env = append(os.Environ(), "GOGC=off")
|
||||
err = icmd.Run()
|
||||
if err != nil {
|
||||
break
|
||||
@ -156,6 +158,7 @@ func Autobuild(files []string, isgenerate bool) {
|
||||
|
||||
if isgenerate {
|
||||
icmd := exec.Command("bee", "generate", "docs")
|
||||
icmd.Env = append(os.Environ(), "GOGC=off")
|
||||
icmd.Stdout = os.Stdout
|
||||
icmd.Stderr = os.Stderr
|
||||
icmd.Run()
|
||||
@ -170,9 +173,13 @@ func Autobuild(files []string, isgenerate bool) {
|
||||
|
||||
args := []string{"build"}
|
||||
args = append(args, "-o", appName)
|
||||
if buildTags != "" {
|
||||
args = append(args, "-tags", buildTags)
|
||||
}
|
||||
args = append(args, files...)
|
||||
|
||||
bcmd := exec.Command(cmdName, args...)
|
||||
bcmd.Env = append(os.Environ(), "GOGC=off")
|
||||
bcmd.Stdout = os.Stdout
|
||||
bcmd.Stderr = os.Stderr
|
||||
err = bcmd.Run()
|
||||
|
Loading…
Reference in New Issue
Block a user