From e6cf83b8c0202ca256ce1b5aaa26459aaaa6532a Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 18 Mar 2015 06:37:44 -0400 Subject: [PATCH] Put default config into binary --- .bra.toml | 1 + cmd/web.go | 14 +- conf/README | 7 + conf/content/git-bare.zip | Bin 9910 -> 0 bytes models/repo.go | 79 ++- modules/bindata/bindata.go | 1041 ++++++++++++++++++++++++++++++++++++ modules/setting/setting.go | 8 +- 7 files changed, 1097 insertions(+), 53 deletions(-) create mode 100644 conf/README delete mode 100644 conf/content/git-bare.zip create mode 100644 modules/bindata/bindata.go diff --git a/.bra.toml b/.bra.toml index 0f52fcdde5..10e7c893f5 100644 --- a/.bra.toml +++ b/.bra.toml @@ -14,6 +14,7 @@ watch_dirs = [ watch_exts = [".go", ".ini"] build_delay = 1500 cmds = [ + #["go-bindata", "-o=modules/bindata/bindata.go", "-ignore=\\.DS_Store|README", "-pkg=bindata", "conf/..."], ["go", "install", "-tags", "sqlite cert"],# redis memcache ["go", "build", "-tags", "sqlite cert"], ["./gogs", "web"] diff --git a/cmd/web.go b/cmd/web.go index a06f5b85ed..f02a98313e 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -34,6 +34,7 @@ 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/bindata" "github.com/gogits/gogs/modules/git" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" @@ -82,7 +83,7 @@ func checkVersion() { {"github.com/macaron-contrib/binding", binding.Version, "0.0.6"}, {"github.com/macaron-contrib/cache", cache.Version, "0.0.7"}, {"github.com/macaron-contrib/csrf", csrf.Version, "0.0.3"}, - {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.5"}, + {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.7"}, {"github.com/macaron-contrib/session", session.Version, "0.1.6"}, {"gopkg.in/ini.v1", ini.Version, "1.2.0"}, } @@ -123,9 +124,18 @@ func newMacaron() *macaron.Macaron { Funcs: []template.FuncMap{base.TemplateFuncs}, IndentJSON: macaron.Env != macaron.PROD, })) + + localeNames, err := bindata.AssetDir("conf/locale") + if err != nil { + log.Fatal(4, "Fail to list locale files: %v", err) + } + localFiles := make(map[string][]byte) + for _, name := range localeNames { + localFiles[name] = bindata.MustAsset("conf/locale/" + name) + } m.Use(i18n.I18n(i18n.Options{ SubURL: setting.AppSubUrl, - Directory: path.Join(setting.ConfRootPath, "locale"), + Files: localFiles, CustomDirectory: path.Join(setting.CustomPath, "conf/locale"), Langs: setting.Langs, Names: setting.Names, diff --git a/conf/README b/conf/README new file mode 100644 index 0000000000..e1e21f2031 --- /dev/null +++ b/conf/README @@ -0,0 +1,7 @@ +Execute following command in ROOT directory when anything is changed: + +$ go-bindata -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README" -pkg=bindata conf/... + +Add -debug flag to make life easier in development(somehow isn't working): + +$ go-bindata -debug -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README" -pkg=bindata conf/... \ No newline at end of file diff --git a/conf/content/git-bare.zip b/conf/content/git-bare.zip deleted file mode 100644 index fde0a1f96ee859f32e18e4b2241174d64cd728c8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9910 zcmb_?1z1(v*7l~6?v71&rywQL-QC@r*mOz?ZfPW>L%Kmk8UX=mlnx0|x&$TU+v?#Q z@bljPKKJ|KnR~Dv2Jbu8SaZ%X)_hS_fP=>a0078$L!?}+?>P-=i(k`WF+9ht z2Cf%5=sUnl%dX|BgVZ|G-yO&dcp)$`nTxJZHElF6Ji8bRq3|8gt!x`jd{V6Oq^C{w zRvZE`NR(nwemUqsg$_$AcMCT=kcXX%GwRTw!doRJHAZ>1Hyp#P{T!wB+OkUhtZIz? zZ&S+*8zM63_Pc{8()P5+~#4ibAL_@#V3Rgc<7Lo zl6b%(uT-bbD6howeneJDk?H-25-YnL+sdy$MS(g2ex~Z@4}X39NR_RNi-S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