1
0
mirror of https://github.com/beego/bee.git synced 2024-06-13 08:43:33 +00:00

Added auto-detect appname

This commit is contained in:
Unknown 2013-09-11 18:35:24 -04:00
parent 0f88e47773
commit a655f78a4e
2 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,5 @@
{
"watch_imports": true,
"go_install": false,
"watch_ext": [],
"dir_structure":{

14
run.go
View File

@ -66,6 +66,8 @@ func init() {
var appname string
var conf struct {
// Indicates whether to watch imports changes.
WatchImports bool `json:"watch_imports"`
// Indicates whether execute "go install" before "go build".
GoInstall bool `json:"go_install"`
WatchExt []string `json:"watch_ext"`
@ -84,12 +86,13 @@ var conf struct {
func runApp(cmd *Command, args []string) {
exit := make(chan bool)
if len(args) != 1 {
com.ColorLog("[ERRO] Cannot start running[ %s ]\n",
"argument 'appname' is missing")
os.Exit(2)
}
crupath, _ := os.Getwd()
if len(args) != 1 {
appname = path.Base(crupath)
com.ColorLog("[INFO] Uses '%s' as 'appname'\n", appname)
} else {
appname = args[0]
}
Debugf("current path:%s\n", crupath)
err := loadConfig()
@ -106,7 +109,6 @@ func runApp(cmd *Command, args []string) {
paths = append(paths, conf.DirStruct.Others...)
NewWatcher(paths)
appname = args[0]
Autobuild()
for {
select {