Merge branch 'master' of https://github.com/gogits/gogs
This commit is contained in:
commit
f9ba8f01d1
5 changed files with 34 additions and 18 deletions
|
@ -3,18 +3,22 @@ path=github.com/gogits/gogs
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
github.com/codegangsta/cli=
|
github.com/codegangsta/cli=
|
||||||
github.com/codegangsta/martini=
|
github.com/go-martini/martini=
|
||||||
github.com/Unknwon/com=
|
github.com/Unknwon/com=
|
||||||
github.com/Unknwon/cae=
|
github.com/Unknwon/cae=
|
||||||
github.com/Unknwon/goconfig=
|
github.com/Unknwon/goconfig=
|
||||||
github.com/dchest/scrypt=
|
github.com/dchest/scrypt=
|
||||||
github.com/nfnt/resize=
|
github.com/nfnt/resize=
|
||||||
github.com/lunny/xorm=
|
github.com/lunny/xorm=
|
||||||
|
github.com/go-sql-driver/mysql=
|
||||||
|
github.com/lib/pq=
|
||||||
github.com/gogits/logs=
|
github.com/gogits/logs=
|
||||||
github.com/gogits/binding=
|
github.com/gogits/binding=
|
||||||
github.com/gogits/git=
|
github.com/gogits/git=
|
||||||
github.com/gogits/gfm=
|
github.com/gogits/gfm=
|
||||||
github.com/gogits/cache=
|
github.com/gogits/cache=
|
||||||
|
github.com/gogits/session=
|
||||||
|
github.com/gogits/webdav=
|
||||||
|
|
||||||
[res]
|
[res]
|
||||||
include=templates|public|conf
|
include=templates|public|conf
|
||||||
|
|
|
@ -83,15 +83,19 @@ func SetEngine() (err error) {
|
||||||
|
|
||||||
// WARNNING: for serv command, MUST remove the output to os.stdout,
|
// WARNNING: for serv command, MUST remove the output to os.stdout,
|
||||||
// so use log file to instead print to stdout.
|
// so use log file to instead print to stdout.
|
||||||
|
execDir, _ := base.ExecDir()
|
||||||
|
logPath := execDir + "/log/xorm.log"
|
||||||
|
os.MkdirAll(path.Dir(logPath), os.ModePerm)
|
||||||
|
|
||||||
//x.ShowDebug = true
|
f, err := os.Create(logPath)
|
||||||
//orm.ShowErr = true
|
|
||||||
f, err := os.Create("xorm.log")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("models.init(fail to create xorm.log): %v\n", err)
|
return fmt.Errorf("models.init(fail to create xorm.log): %v\n", err)
|
||||||
}
|
}
|
||||||
orm.Logger = f
|
orm.Logger = f
|
||||||
|
|
||||||
orm.ShowSQL = true
|
orm.ShowSQL = true
|
||||||
|
orm.ShowDebug = true
|
||||||
|
orm.ShowErr = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
serve.go
2
serve.go
|
@ -47,7 +47,7 @@ func newLogger(execDir string) {
|
||||||
level := "0"
|
level := "0"
|
||||||
logPath := execDir + "/log/serv.log"
|
logPath := execDir + "/log/serv.log"
|
||||||
os.MkdirAll(path.Dir(logPath), os.ModePerm)
|
os.MkdirAll(path.Dir(logPath), os.ModePerm)
|
||||||
log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, logPath))
|
log.NewLogger(0, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, logPath))
|
||||||
log.Trace("start logging...")
|
log.Trace("start logging...")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
## gogs test
|
## Gogs Test
|
||||||
|
|
||||||
this is for developers
|
This is for developers.
|
||||||
|
|
||||||
|
## Prepare Environment
|
||||||
|
|
||||||
## prepare environment
|
|
||||||
go get -u github.com/shxsun/travelexec
|
go get -u github.com/shxsun/travelexec
|
||||||
# start gogs server
|
# start gogs server
|
||||||
gogs web
|
gogs web
|
||||||
|
|
||||||
## start test
|
## Start Testing
|
||||||
|
|
||||||
travelexec
|
travelexec
|
||||||
|
|
24
update.go
24
update.go
|
@ -6,17 +6,19 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
//"github.com/gogits/gogs/modules/log"
|
|
||||||
"github.com/gogits/git"
|
"github.com/gogits/git"
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/qiniu/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
|
//"github.com/qiniu/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var CmdUpdate = cli.Command{
|
var CmdUpdate = cli.Command{
|
||||||
|
@ -28,25 +30,29 @@ gogs serv provide access auth for repositories`,
|
||||||
Flags: []cli.Flag{},
|
Flags: []cli.Flag{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newUpdateLogger(execDir string) {
|
||||||
|
level := "0"
|
||||||
|
logPath := execDir + "/log/update.log"
|
||||||
|
os.MkdirAll(path.Dir(logPath), os.ModePerm)
|
||||||
|
log.NewLogger(0, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, logPath))
|
||||||
|
log.Trace("start logging...")
|
||||||
|
}
|
||||||
|
|
||||||
// for command: ./gogs update
|
// for command: ./gogs update
|
||||||
func runUpdate(c *cli.Context) {
|
func runUpdate(c *cli.Context) {
|
||||||
|
execDir, _ := base.ExecDir()
|
||||||
|
newLogger(execDir)
|
||||||
|
|
||||||
base.NewConfigContext()
|
base.NewConfigContext()
|
||||||
models.LoadModelsConfig()
|
models.LoadModelsConfig()
|
||||||
|
|
||||||
if models.UseSQLite3 {
|
if models.UseSQLite3 {
|
||||||
execDir, _ := base.ExecDir()
|
|
||||||
os.Chdir(execDir)
|
os.Chdir(execDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
models.SetEngine()
|
models.SetEngine()
|
||||||
|
|
||||||
w, _ := os.Create("update.log")
|
|
||||||
defer w.Close()
|
|
||||||
|
|
||||||
log.SetOutput(w)
|
|
||||||
|
|
||||||
args := c.Args()
|
args := c.Args()
|
||||||
//log.Info(args)
|
|
||||||
if len(args) != 3 {
|
if len(args) != 3 {
|
||||||
log.Error("received less 3 parameters")
|
log.Error("received less 3 parameters")
|
||||||
return
|
return
|
||||||
|
|
Reference in a new issue