From 76c64b43cb56a298e5fc2ec8adc0d7b820cbe614 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 31 Mar 2014 07:57:51 -0400 Subject: [PATCH 1/3] Prepare for 0.2.0 release --- .gopmfile | 6 +++++- serve.go | 2 +- tests/README.md | 10 ++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gopmfile b/.gopmfile index bd641a17c..9857af350 100644 --- a/.gopmfile +++ b/.gopmfile @@ -3,18 +3,22 @@ path=github.com/gogits/gogs [deps] github.com/codegangsta/cli= -github.com/codegangsta/martini= +github.com/go-martini/martini= github.com/Unknwon/com= github.com/Unknwon/cae= github.com/Unknwon/goconfig= github.com/dchest/scrypt= github.com/nfnt/resize= github.com/lunny/xorm= +github.com/go-sql-driver/mysql= +github.com/lib/pq= github.com/gogits/logs= github.com/gogits/binding= github.com/gogits/git= github.com/gogits/gfm= github.com/gogits/cache= +github.com/gogits/session= +github.com/gogits/webdav= [res] include=templates|public|conf diff --git a/serve.go b/serve.go index 96cd7e73d..afc16c281 100644 --- a/serve.go +++ b/serve.go @@ -47,7 +47,7 @@ func newLogger(execDir string) { level := "0" logPath := execDir + "/log/serv.log" 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...") } diff --git a/tests/README.md b/tests/README.md index 98693257f..e51b25103 100644 --- a/tests/README.md +++ b/tests/README.md @@ -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 # start gogs server gogs web -## start test +## Start Testing + travelexec From a187ba96512a49ac7888d87960657ab6ee369a50 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 31 Mar 2014 21:26:15 +0800 Subject: [PATCH 2/3] improved log locations --- conf/app.ini | 2 +- models/models.go | 10 +++++++--- update.go | 24 +++++++++++++++--------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/conf/app.ini b/conf/app.ini index abc27c39c..bb620d474 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -32,7 +32,7 @@ PATH = data/gogs.db [admin] [security] -INSTALL_LOCK = false +INSTALL_LOCK = true ; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!! SECRET_KEY = !#@FDEWREWR&*( ; Auto-login remember days diff --git a/models/models.go b/models/models.go index a626b98f6..384f1fc42 100644 --- a/models/models.go +++ b/models/models.go @@ -83,15 +83,19 @@ func SetEngine() (err error) { // WARNNING: for serv command, MUST remove the output to os.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 - //orm.ShowErr = true - f, err := os.Create("xorm.log") + f, err := os.Create(logPath) if err != nil { return fmt.Errorf("models.init(fail to create xorm.log): %v\n", err) } orm.Logger = f + orm.ShowSQL = true + orm.ShowDebug = true + orm.ShowErr = true return nil } diff --git a/update.go b/update.go index e36dc2232..5ccb72fd4 100644 --- a/update.go +++ b/update.go @@ -6,17 +6,19 @@ package main import ( "container/list" + "fmt" "os" "os/exec" + "path" "strconv" "strings" "github.com/codegangsta/cli" - //"github.com/gogits/gogs/modules/log" "github.com/gogits/git" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" - "github.com/qiniu/log" + "github.com/gogits/gogs/modules/log" + //"github.com/qiniu/log" ) var CmdUpdate = cli.Command{ @@ -28,25 +30,29 @@ gogs serv provide access auth for repositories`, 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 func runUpdate(c *cli.Context) { + execDir, _ := base.ExecDir() + newLogger(execDir) + base.NewConfigContext() models.LoadModelsConfig() if models.UseSQLite3 { - execDir, _ := base.ExecDir() os.Chdir(execDir) } models.SetEngine() - w, _ := os.Create("update.log") - defer w.Close() - - log.SetOutput(w) - args := c.Args() - //log.Info(args) if len(args) != 3 { log.Error("received less 3 parameters") return From 10ba28deba2e5b53be6c78d8ce99383d5c70b31d Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 31 Mar 2014 10:12:36 -0400 Subject: [PATCH 3/3] Huge bug fix --- conf/app.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.ini b/conf/app.ini index bb620d474..abc27c39c 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -32,7 +32,7 @@ PATH = data/gogs.db [admin] [security] -INSTALL_LOCK = true +INSTALL_LOCK = false ; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!! SECRET_KEY = !#@FDEWREWR&*( ; Auto-login remember days