1
0
mirror of https://github.com/beego/bee.git synced 2025-07-11 08:01:01 +00:00

Merge branch 'develop' into new-features

This commit is contained in:
Faissal Elamraoui
2016-07-28 13:34:55 +02:00
14 changed files with 154 additions and 121 deletions

20
run.go
View File

@ -20,12 +20,11 @@ import (
path "path/filepath"
"runtime"
"strings"
"fmt"
)
var cmdRun = &Command{
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",
UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-vendor=true] [-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,
it will recompile and restart the app after any modifications.
@ -44,12 +43,15 @@ var excludedPaths strFlags
// Pass through to -tags arg of "go build"
var buildTags string
var vendorWatch bool
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 does not exist")
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.BoolVar(&vendorWatch, "vendor", false, "Watch vendor folder")
cmdRun.Flag.StringVar(&buildTags, "tags", "", "Build tags (https://golang.org/pkg/go/build/)")
}
@ -127,7 +129,7 @@ func runApp(cmd *Command, args []string) int {
if downdoc == "true" {
if _, err := os.Stat(path.Join(currpath, "swagger")); err != nil {
if os.IsNotExist(err) {
downloadFromUrl(swaggerlink, "swagger.zip")
downloadFromURL(swaggerlink, "swagger.zip")
unzipAndDelete("swagger.zip", "swagger")
}
}
@ -152,6 +154,10 @@ func readAppDirectories(directory string, paths *[]string) {
continue
}
if !vendorWatch && strings.HasSuffix(fileInfo.Name(), "vendor") {
continue
}
if isExcluded(path.Join(directory, fileInfo.Name())) {
continue
}