mirror of
				https://github.com/beego/bee.git
				synced 2025-10-25 22:13:52 +00:00 
			
		
		
		
	add dev githook command
This commit is contained in:
		| @@ -1,11 +1,14 @@ | ||||
| package beegopro | ||||
|  | ||||
| import ( | ||||
| 	"io/ioutil" | ||||
|  | ||||
| 	"github.com/beego/bee/internal/pkg/utils" | ||||
| 	beeLogger "github.com/beego/bee/logger" | ||||
| 	"io/ioutil" | ||||
| ) | ||||
|  | ||||
| var CompareExcept = []string{"@BeeGenerateTime"} | ||||
|  | ||||
| func (c *Container) GenConfig() { | ||||
| 	if utils.IsExist(c.BeegoProFile) { | ||||
| 		beeLogger.Log.Fatalf("beego pro toml exist") | ||||
|   | ||||
| @@ -2,6 +2,10 @@ package beegopro | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"io/ioutil" | ||||
| 	"sync" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/beego/bee/internal/pkg/git" | ||||
| 	"github.com/beego/bee/internal/pkg/system" | ||||
| 	beeLogger "github.com/beego/bee/logger" | ||||
| @@ -9,9 +13,6 @@ import ( | ||||
| 	"github.com/davecgh/go-spew/spew" | ||||
| 	"github.com/pelletier/go-toml" | ||||
| 	"github.com/spf13/viper" | ||||
| 	"io/ioutil" | ||||
| 	"sync" | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| const MDateFormat = "20060102_150405" | ||||
|   | ||||
| @@ -2,11 +2,12 @@ package beegopro | ||||
|  | ||||
| import ( | ||||
| 	"database/sql" | ||||
| 	beeLogger "github.com/beego/bee/logger" | ||||
| 	"github.com/beego/bee/utils" | ||||
| 	"io/ioutil" | ||||
| 	"path/filepath" | ||||
| 	"strings" | ||||
|  | ||||
| 	beeLogger "github.com/beego/bee/logger" | ||||
| 	"github.com/beego/bee/utils" | ||||
| ) | ||||
|  | ||||
| var SQL utils.DocValue | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package beegopro | ||||
| import ( | ||||
| 	"database/sql" | ||||
| 	"fmt" | ||||
|  | ||||
| 	"github.com/beego/bee/internal/pkg/utils" | ||||
| 	beeLogger "github.com/beego/bee/logger" | ||||
| ) | ||||
|   | ||||
| @@ -1,10 +1,11 @@ | ||||
| package beegopro | ||||
|  | ||||
| import ( | ||||
| 	"github.com/beego/bee/utils" | ||||
| 	"github.com/flosch/pongo2" | ||||
| 	"strings" | ||||
| 	"unicode/utf8" | ||||
|  | ||||
| 	"github.com/beego/bee/utils" | ||||
| 	"github.com/flosch/pongo2" | ||||
| ) | ||||
|  | ||||
| func init() { | ||||
|   | ||||
| @@ -123,7 +123,7 @@ func (r *RenderFile) Exec(name string) { | ||||
| 	var orgContent []byte | ||||
| 	if err == nil { | ||||
| 		if org, err := os.OpenFile(r.Descriptor.DstPath, os.O_RDONLY, 0666); err == nil { | ||||
| 			orgContent,_ = ioutil.ReadAll(org) | ||||
| 			orgContent, _ = ioutil.ReadAll(org) | ||||
| 			org.Close() | ||||
| 		} else { | ||||
| 			beeLogger.Log.Infof("file err %s", err) | ||||
| @@ -151,4 +151,3 @@ func (r *RenderFile) Exec(name string) { | ||||
| 		beeLogger.Log.Infof("create file '%s' from %s", r.FlushFile, r.PackageName) | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -2,15 +2,16 @@ package beegopro | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"path/filepath" | ||||
| 	"strings" | ||||
| 	"sync" | ||||
|  | ||||
| 	"github.com/beego/bee/internal/pkg/command" | ||||
| 	"github.com/beego/bee/internal/pkg/system" | ||||
| 	beeLogger "github.com/beego/bee/logger" | ||||
| 	"github.com/beego/bee/utils" | ||||
| 	"github.com/flosch/pongo2" | ||||
| 	"github.com/smartwalle/pongo2render" | ||||
| 	"path/filepath" | ||||
| 	"strings" | ||||
| 	"sync" | ||||
| ) | ||||
|  | ||||
| // store all data | ||||
|   | ||||
| @@ -1,8 +1,9 @@ | ||||
| package beegopro | ||||
|  | ||||
| import ( | ||||
| 	"github.com/beego/bee/utils" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/beego/bee/utils" | ||||
| ) | ||||
|  | ||||
| // parse get the model info | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package beegopro | ||||
| import ( | ||||
| 	"database/sql" | ||||
| 	"errors" | ||||
|  | ||||
| 	"github.com/beego/bee/logger" | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -173,14 +173,14 @@ func getModelType(orm string) (inputType, goType, mysqlType, tag string) { | ||||
| 	return | ||||
| } | ||||
|  | ||||
| func FileContentChange(org,new []byte, seg string) bool { | ||||
| func FileContentChange(org, new []byte, seg string) bool { | ||||
| 	if len(org) == 0 { | ||||
| 		return true | ||||
| 	} | ||||
| 	orgContent := GetFilterContent(string(org),seg) | ||||
| 	newContent := GetFilterContent(string(new),seg) | ||||
| 	orgContent := GetFilterContent(string(org), seg) | ||||
| 	newContent := GetFilterContent(string(new), seg) | ||||
| 	orgMd5 := md5.Sum([]byte(orgContent)) | ||||
| 	newMd5:= md5.Sum([]byte(newContent)) | ||||
| 	newMd5 := md5.Sum([]byte(newContent)) | ||||
| 	if orgMd5 != newMd5 { | ||||
| 		return true | ||||
| 	} | ||||
| @@ -193,7 +193,7 @@ func GetFilterContent(content string, seg string) string { | ||||
| 	for _, s := range strings.Split(content, "\n") { | ||||
| 		s = strings.TrimSpace(strings.TrimPrefix(s, seg)) | ||||
| 		var have bool | ||||
| 		for _,except := range CompareExcept{ | ||||
| 		for _, except := range CompareExcept { | ||||
| 			if strings.HasPrefix(s, except) { | ||||
| 				have = true | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Ming Deng
					Ming Deng