add Makefile
This commit is contained in:
parent
0af035c37e
commit
a374751eb8
4 changed files with 45 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -36,3 +36,4 @@ docker/docker/init_gogs.sh
|
||||||
gogs.sublime-project
|
gogs.sublime-project
|
||||||
gogs.sublime-workspace
|
gogs.sublime-workspace
|
||||||
.tags*
|
.tags*
|
||||||
|
release
|
||||||
|
|
30
Makefile
Normal file
30
Makefile
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
|
||||||
|
LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildGitHash=$(shell git rev-parse HEAD)"
|
||||||
|
|
||||||
|
TAGS = ""
|
||||||
|
|
||||||
|
RELEASE_ROOT = "release"
|
||||||
|
RELEASE_GOGS = "release/gogs"
|
||||||
|
NOW = $(shell date -u '+%Y%m%d%I%M%S')
|
||||||
|
|
||||||
|
.PHONY: build pack release bindata clean
|
||||||
|
|
||||||
|
build:
|
||||||
|
go install -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
|
||||||
|
go build -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
|
||||||
|
|
||||||
|
pack:
|
||||||
|
find . -name ".DS_Store" -print0 | xargs -0 rm
|
||||||
|
rm -rf $(RELEASE_GOGS)
|
||||||
|
mkdir -p $(RELEASE_GOGS)
|
||||||
|
cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
|
||||||
|
rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
|
||||||
|
cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
|
||||||
|
|
||||||
|
release: build pack
|
||||||
|
|
||||||
|
bindata:
|
||||||
|
go-bindata -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README.md" -pkg=bindata conf/...
|
||||||
|
|
||||||
|
clean:
|
||||||
|
go clean -i ./...
|
10
cmd/web.go
10
cmd/web.go
|
@ -82,11 +82,11 @@ func checkVersion() {
|
||||||
checkers := []VerChecker{
|
checkers := []VerChecker{
|
||||||
{"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.3.0806"},
|
{"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.3.0806"},
|
||||||
{"github.com/Unknwon/macaron", macaron.Version, "0.5.4"},
|
{"github.com/Unknwon/macaron", macaron.Version, "0.5.4"},
|
||||||
{"github.com/macaron-contrib/binding", binding.Version, "0.1.0"},
|
{"github.com/go-macaron/binding", binding.Version, "0.1.0"},
|
||||||
{"github.com/macaron-contrib/cache", cache.Version, "0.1.2"},
|
{"github.com/go-macaron/cache", cache.Version, "0.1.2"},
|
||||||
{"github.com/macaron-contrib/csrf", csrf.Version, "0.0.3"},
|
{"github.com/go-macaron/csrf", csrf.Version, "0.0.3"},
|
||||||
{"github.com/macaron-contrib/i18n", i18n.Version, "0.0.7"},
|
{"github.com/go-macaron/i18n", i18n.Version, "0.0.7"},
|
||||||
{"github.com/macaron-contrib/session", session.Version, "0.1.6"},
|
{"github.com/go-macaron/session", session.Version, "0.1.6"},
|
||||||
{"gopkg.in/ini.v1", ini.Version, "1.3.4"},
|
{"gopkg.in/ini.v1", ini.Version, "1.3.4"},
|
||||||
}
|
}
|
||||||
for _, c := range checkers {
|
for _, c := range checkers {
|
||||||
|
|
|
@ -42,6 +42,10 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// Build information.
|
||||||
|
BuildTime string
|
||||||
|
BuildGitHash string
|
||||||
|
|
||||||
// App settings.
|
// App settings.
|
||||||
AppVer string
|
AppVer string
|
||||||
AppName string
|
AppName string
|
||||||
|
@ -471,6 +475,11 @@ var logLevels = map[string]string{
|
||||||
func newLogService() {
|
func newLogService() {
|
||||||
log.Info("%s %s", AppName, AppVer)
|
log.Info("%s %s", AppName, AppVer)
|
||||||
|
|
||||||
|
if len(BuildTime) > 0 {
|
||||||
|
log.Info("Build Time: %s", BuildTime)
|
||||||
|
log.Info("Build Git Hash: %s", BuildGitHash)
|
||||||
|
}
|
||||||
|
|
||||||
// Get and check log mode.
|
// Get and check log mode.
|
||||||
LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
|
LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
|
||||||
LogConfigs = make([]string, len(LogModes))
|
LogConfigs = make([]string, len(LogModes))
|
||||||
|
|
Loading…
Add table
Reference in a new issue