Browse Source

Fix #200, add VERSION to template files

tags/v0.9.99
Unknown 10 years ago
parent
commit
ff690fd976
7 changed files with 24 additions and 21 deletions
  1. 3
    2
      .gopmfile
  2. 4
    5
      cmd/web.go
  3. 7
    0
      conf/README.md
  4. 0
    12
      modules/bin/conf.go
  5. 5
    0
      routers/repo/issue.go
  6. 0
    0
      templates/VERSION
  7. 5
    2
      templates/issue/list.tmpl

+ 3
- 2
.gopmfile View File

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


+ 4
- 5
cmd/web.go View File

@@ -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?")

+ 7
- 0
conf/README.md View File

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

+ 0
- 12
modules/bin/conf.go View File

@@ -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,
}

+ 5
- 0
routers/repo/issue.go View File

@@ -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) {

conf/VERSION → templates/VERSION View File


+ 5
- 2
templates/issue/list.tmpl View File

@@ -71,9 +71,12 @@
{{range .Issues}}{{if .Poster}}
<div class="list-group-item issue-item{{if not .IsRead}} unread{{end}}" id="issue-{{.Id}}">
<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="label" style="background-color: #28a1c5">tag</span>
{{range .Labels}}
<span class="label" style="background-color: {{.Color}}">{{.Name}}</span>
{{end}}
</span>
</h5>
<p class="info">

Loading…
Cancel
Save