From ff690fd9760e0cfb5ae9e49aecb7a201f7ca8304 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 28 May 2014 00:06:31 -0400 Subject: [PATCH] Fix #200, add VERSION to template files --- .gopmfile | 5 +++-- cmd/web.go | 9 ++++----- conf/README.md | 7 +++++++ modules/bin/conf.go | 12 ------------ routers/repo/issue.go | 5 +++++ {conf => templates}/VERSION | 0 templates/issue/list.tmpl | 7 +++++-- 7 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 conf/README.md rename {conf => templates}/VERSION (100%) diff --git a/.gopmfile b/.gopmfile index c58f4299..35f40b39 100644 --- a/.gopmfile +++ b/.gopmfile @@ -8,6 +8,7 @@ github.com/Unknwon/goconfig = github.com/codegangsta/cli = github.com/go-martini/martini = github.com/go-sql-driver/mysql = +github.com/go-xorm/core = github.com/go-xorm/xorm = github.com/gogits/cache = github.com/gogits/gfm = @@ -15,12 +16,12 @@ github.com/gogits/git = github.com/gogits/logs = github.com/gogits/oauth2 = github.com/gogits/session = +github.com/juju2013/goldap = github.com/lib/pq = github.com/nfnt/resize = github.com/qiniu/log = github.com/robfig/cron = -github.com/juju2013/goldap = [res] -include = templates|public|conf +include = templates|public diff --git a/cmd/web.go b/cmd/web.go index f4b31dcd..d8d9785f 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -7,6 +7,7 @@ package cmd import ( "fmt" "html/template" + "io/ioutil" "net/http" "os" "path" @@ -18,7 +19,6 @@ import ( "github.com/gogits/gogs/modules/auth/apiv1" "github.com/gogits/gogs/modules/avatar" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/bin" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/middleware/binding" @@ -40,12 +40,11 @@ and it takes care of all the other things for you`, Flags: []cli.Flag{}, } +// checkVersion checks if binary matches the version of temolate files. func checkVersion() { - // go-bindata -ignore=\\.DS_Store -o modules/bin/conf.go -pkg="bin" conf/... - // Check if binary and static file version match. - data, err := bin.Asset("conf/VERSION") + data, err := ioutil.ReadFile(path.Join(setting.StaticRootPath, "templates/VERSION")) if err != nil { - log.Fatal("Fail to read 'conf/VERSION': %v", err) + log.Fatal("Fail to read 'templates/VERSION': %v", err) } if string(data) != setting.AppVer { log.Fatal("Binary and static file version does not match, did you forget to recompile?") diff --git a/conf/README.md b/conf/README.md new file mode 100644 index 00000000..96e0eb22 --- /dev/null +++ b/conf/README.md @@ -0,0 +1,7 @@ +## NOTICE + +This directory only used for development, and us [go-bindata](https://github.com/jteeuwen/go-bindata) to store in memory for releases. + +To apply any change in this directory, install [go-bindata](https://github.com/jteeuwen/go-bindata), and then execute following command in root of source directory: + + $ go-bindata -ignore="\\.DS_Store|README.md" -o modules/bin/conf.go -pkg="bin" conf/... \ No newline at end of file diff --git a/modules/bin/conf.go b/modules/bin/conf.go index 17af830a..6779f18f 100644 --- a/modules/bin/conf.go +++ b/modules/bin/conf.go @@ -3562,17 +3562,6 @@ func conf_supervisor_ini() ([]byte, error) { ) } -func conf_version() ([]byte, error) { - return bindata_read([]byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0x32, 0xd0, - 0x33, 0xd6, 0x33, 0xd3, 0x33, 0x30, 0x35, 0x32, 0x55, 0x70, 0xcc, 0x29, - 0xc8, 0x48, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x57, 0x04, 0x8d, 0x28, - 0x10, 0x00, 0x00, 0x00, - }, - "conf/VERSION", - ) -} - // Asset loads and returns the asset for the given name. // It returns an error if the asset could not be found or @@ -3616,5 +3605,4 @@ var _bindata = map[string] func() ([]byte, error) { "conf/license/MIT License": conf_license_mit_license, "conf/mysql.sql": conf_mysql_sql, "conf/supervisor.ini": conf_supervisor_ini, - "conf/VERSION": conf_version, } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index d09a2396..808fb52b 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -95,6 +95,11 @@ func Issues(ctx *middleware.Context) { // Get posters. for i := range issues { + if err = issues[i].GetLabels(); err != nil { + ctx.Handle(500, "issue.Issues(GetLabels)", fmt.Errorf("[#%d]%v", issues[i].Id, err)) + return + } + idx := models.PairsContains(pairs, issues[i].Id) if filterMode == models.FM_MENTION && (idx == -1 || !pairs[idx].IsMentioned) { diff --git a/conf/VERSION b/templates/VERSION similarity index 100% rename from conf/VERSION rename to templates/VERSION diff --git a/templates/issue/list.tmpl b/templates/issue/list.tmpl index aac27943..0fae3eb6 100644 --- a/templates/issue/list.tmpl +++ b/templates/issue/list.tmpl @@ -71,9 +71,12 @@ {{range .Issues}}{{if .Poster}}
#{{.Index}} -
{{.Name}} +
+ {{.Name}} - tag + {{range .Labels}} + {{.Name}} + {{end}}