diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-12-15 01:49:59 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-12-15 01:49:59 -0500 |
commit | 9803c421f56771805a9d63280a0c830f6db3b13b (patch) | |
tree | 68fdd6d6270d65c77f239cfc3d1e2eac5df33692 /cmd | |
parent | 792ec63c8a9256734c51ba9b846e5da0030b67e1 (diff) | |
download | gitea-9803c421f56771805a9d63280a0c830f6db3b13b.tar.gz gitea-9803c421f56771805a9d63280a0c830f6db3b13b.zip |
fix binding api broken
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/cmd/web.go b/cmd/web.go index df9a380c11..38b802b682 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -55,6 +55,12 @@ and it takes care of all the other things for you`, Flags: []cli.Flag{}, } +type VerChecker struct { + ImportPath string + Version func() string + Expected string +} + // checkVersion checks if binary matches the version of templates files. func checkVersion() { // Templates. @@ -67,17 +73,17 @@ func checkVersion() { } // Check dependency version. - macaronVer := git.MustParseVersion(strings.Join(strings.Split(macaron.Version(), ".")[:3], ".")) - if macaronVer.LessThan(git.MustParseVersion("0.4.7")) { - log.Fatal(4, "Package macaron version is too old, did you forget to update?(github.com/Unknwon/macaron)") + checkers := []VerChecker{ + {"github.com/Unknwon/macaron", macaron.Version, "0.4.7"}, + {"github.com/macaron-contrib/binding", binding.Version, "0.0.2"}, + {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.3"}, + {"github.com/macaron-contrib/session", session.Version, "0.0.5"}, } - i18nVer := git.MustParseVersion(i18n.Version()) - if i18nVer.LessThan(git.MustParseVersion("0.0.2")) { - log.Fatal(4, "Package i18n version is too old, did you forget to update?(github.com/macaron-contrib/i18n)") - } - sessionVer := git.MustParseVersion(session.Version()) - if sessionVer.LessThan(git.MustParseVersion("0.0.5")) { - log.Fatal(4, "Package session version is too old, did you forget to update?(github.com/macaron-contrib/session)") + for _, c := range checkers { + ver := strings.Join(strings.Split(c.Version(), ".")[:3], ".") + if git.MustParseVersion(ver).LessThan(git.MustParseVersion(c.Expected)) { + log.Fatal(4, "Package '%s' version is too old(%s -> %s), did you forget to update?", c.ImportPath, ver, c.Expected) + } } } |