Skip to content

Commit ff48aed

Browse files
committed
Little bug fix
1 parent d72fdc9 commit ff48aed

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

cmd/web.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/gogits/gogs/modules/auth/apiv1"
1919
"github.com/gogits/gogs/modules/avatar"
2020
"github.com/gogits/gogs/modules/base"
21+
"github.com/gogits/gogs/modules/bin"
2122
"github.com/gogits/gogs/modules/log"
2223
"github.com/gogits/gogs/modules/middleware"
2324
"github.com/gogits/gogs/modules/middleware/binding"
@@ -39,6 +40,18 @@ and it takes care of all the other things for you`,
3940
Flags: []cli.Flag{},
4041
}
4142

43+
func checkVersion() {
44+
// go-bindata -ignore=\\.DS_Store -o modules/bin/conf.go -pkg="bin" conf/...
45+
// Check if binary and static file version match.
46+
data, err := bin.Asset("conf/VERSION")
47+
if err != nil {
48+
log.Fatal("Fail to read 'conf/VERSION': %v", err)
49+
}
50+
if string(data) != setting.AppVer {
51+
log.Fatal("Binary and static file version does not match, did you forget to recompile?")
52+
}
53+
}
54+
4255
func newMartini() *martini.ClassicMartini {
4356
r := martini.NewRouter()
4457
m := martini.New()
@@ -52,6 +65,7 @@ func newMartini() *martini.ClassicMartini {
5265
}
5366

5467
func runWeb(*cli.Context) {
68+
checkVersion()
5569
routers.GlobalInit()
5670

5771
m := newMartini()

gogs.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,14 @@ import (
1414
"github.com/codegangsta/cli"
1515

1616
"github.com/gogits/gogs/cmd"
17-
"github.com/gogits/gogs/modules/bin"
18-
"github.com/gogits/gogs/modules/log"
1917
"github.com/gogits/gogs/modules/setting"
2018
)
2119

2220
const APP_VER = "0.3.6.0525 Alpha"
2321

2422
func init() {
2523
runtime.GOMAXPROCS(runtime.NumCPU())
26-
27-
// go-bindata -ignore=\\.DS_Store -debug -o modules/bin/conf.go -pkg="bin" conf/...
28-
// Set and check if binary and static file version match.
2924
setting.AppVer = APP_VER
30-
data, err := bin.Asset("conf/VERSION")
31-
if err != nil {
32-
log.Fatal("Fail to read 'conf/VERSION': %v", err)
33-
}
34-
if string(data) != setting.AppVer {
35-
log.Fatal("Binary and static file version does not match, did you forget to recompile?")
36-
}
3725
}
3826

3927
func main() {

modules/setting/setting.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func WorkDir() (string, error) {
9999
}
100100

101101
// NewConfigContext initializes configuration context.
102+
// NOTE: do not print any log except error.
102103
func NewConfigContext() {
103104
workDir, err := WorkDir()
104105
if err != nil {
@@ -118,7 +119,6 @@ func NewConfigContext() {
118119
if len(CustomPath) == 0 {
119120
CustomPath = path.Join(workDir, "custom")
120121
}
121-
log.Trace("Custom path: %s", CustomPath)
122122

123123
cfgPath := path.Join(CustomPath, "conf/app.ini")
124124
if com.IsFile(cfgPath) {

routers/install.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func NewServices() {
4646
// GlobalInit is for global configuration reload-able.
4747
func GlobalInit() {
4848
setting.NewConfigContext()
49+
log.Trace("Custom path: %s", setting.CustomPath)
4950
mailer.NewMailerContext()
5051
models.LoadModelsConfig()
5152
models.LoadRepoConfig()

0 commit comments

Comments
 (0)