Fix #200, add VERSION to template files

tokarchuk/v1.17
Unknown 11 years ago
parent bcfa78b8b5
commit ff690fd976
  1. 5
      .gopmfile
  2. 9
      cmd/web.go
  3. 7
      conf/README.md
  4. 12
      modules/bin/conf.go
  5. 5
      routers/repo/issue.go
  6. 0
      templates/VERSION
  7. 7
      templates/issue/list.tmpl

@ -8,6 +8,7 @@ github.com/Unknwon/goconfig =
github.com/codegangsta/cli = github.com/codegangsta/cli =
github.com/go-martini/martini = github.com/go-martini/martini =
github.com/go-sql-driver/mysql = github.com/go-sql-driver/mysql =
github.com/go-xorm/core =
github.com/go-xorm/xorm = github.com/go-xorm/xorm =
github.com/gogits/cache = github.com/gogits/cache =
github.com/gogits/gfm = github.com/gogits/gfm =
@ -15,12 +16,12 @@ github.com/gogits/git =
github.com/gogits/logs = github.com/gogits/logs =
github.com/gogits/oauth2 = github.com/gogits/oauth2 =
github.com/gogits/session = github.com/gogits/session =
github.com/juju2013/goldap =
github.com/lib/pq = github.com/lib/pq =
github.com/nfnt/resize = github.com/nfnt/resize =
github.com/qiniu/log = github.com/qiniu/log =
github.com/robfig/cron = github.com/robfig/cron =
github.com/juju2013/goldap =
[res] [res]
include = templates|public|conf include = templates|public

@ -7,6 +7,7 @@ package cmd
import ( import (
"fmt" "fmt"
"html/template" "html/template"
"io/ioutil"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -18,7 +19,6 @@ import (
"github.com/gogits/gogs/modules/auth/apiv1" "github.com/gogits/gogs/modules/auth/apiv1"
"github.com/gogits/gogs/modules/avatar" "github.com/gogits/gogs/modules/avatar"
"github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/bin"
"github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/middleware/binding" "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{}, Flags: []cli.Flag{},
} }
// checkVersion checks if binary matches the version of temolate files.
func checkVersion() { func checkVersion() {
// go-bindata -ignore=\\.DS_Store -o modules/bin/conf.go -pkg="bin" conf/... data, err := ioutil.ReadFile(path.Join(setting.StaticRootPath, "templates/VERSION"))
// Check if binary and static file version match.
data, err := bin.Asset("conf/VERSION")
if err != nil { 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 { if string(data) != setting.AppVer {
log.Fatal("Binary and static file version does not match, did you forget to recompile?") log.Fatal("Binary and static file version does not match, did you forget to recompile?")

@ -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/...

@ -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. // Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or // 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/license/MIT License": conf_license_mit_license,
"conf/mysql.sql": conf_mysql_sql, "conf/mysql.sql": conf_mysql_sql,
"conf/supervisor.ini": conf_supervisor_ini, "conf/supervisor.ini": conf_supervisor_ini,
"conf/VERSION": conf_version,
} }

@ -95,6 +95,11 @@ func Issues(ctx *middleware.Context) {
// Get posters. // Get posters.
for i := range issues { 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) idx := models.PairsContains(pairs, issues[i].Id)
if filterMode == models.FM_MENTION && (idx == -1 || !pairs[idx].IsMentioned) { if filterMode == models.FM_MENTION && (idx == -1 || !pairs[idx].IsMentioned) {

@ -71,9 +71,12 @@
{{range .Issues}}{{if .Poster}} {{range .Issues}}{{if .Poster}}
<div class="list-group-item issue-item{{if not .IsRead}} unread{{end}}" id="issue-{{.Id}}"> <div class="list-group-item issue-item{{if not .IsRead}} unread{{end}}" id="issue-{{.Id}}">
<span class="number pull-right">#{{.Index}}</span> <span class="number pull-right">#{{.Index}}</span>
<h5 class="title"><a href="{{$.RepoLink}}/issues/{{.Index}}">{{.Name}}</a> <h5 class="title">
<a href="{{$.RepoLink}}/issues/{{.Index}}">{{.Name}}</a>
<span class="labels"> <span class="labels">
<span class="label" style="background-color: #28a1c5">tag</span> {{range .Labels}}
<span class="label" style="background-color: {{.Color}}">{{.Name}}</span>
{{end}}
</span> </span>
</h5> </h5>
<p class="info"> <p class="info">

Loading…
Cancel
Save