gogs.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // +build go1.2
  2. // Copyright 2014 The Gogs Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. // Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language.
  6. package main
  7. import (
  8. "os"
  9. "runtime"
  10. "github.com/codegangsta/cli"
  11. "github.com/gogits/gogs/cmd"
  12. "github.com/gogits/gogs/modules/bin"
  13. "github.com/gogits/gogs/modules/log"
  14. "github.com/gogits/gogs/modules/setting"
  15. )
  16. const APP_VER = "0.3.6.0525 Alpha"
  17. func init() {
  18. runtime.GOMAXPROCS(runtime.NumCPU())
  19. // go-bindata -ignore=\\.DS_Store -debug -o modules/bin/conf.go -pkg="bin" conf/...
  20. // Set and check if binary and static file version match.
  21. setting.AppVer = APP_VER
  22. data, err := bin.Asset("conf/VERSION")
  23. if err != nil {
  24. log.Fatal("Fail to read 'conf/VERSION': %v", err)
  25. }
  26. if string(data) != setting.AppVer {
  27. log.Fatal("Binary and static file version does not match, did you forget to recompile?")
  28. }
  29. }
  30. func main() {
  31. app := cli.NewApp()
  32. app.Name = "Gogs"
  33. app.Usage = "Go Git Service"
  34. app.Version = APP_VER
  35. app.Commands = []cli.Command{
  36. cmd.CmdWeb,
  37. // cmd.CmdFix,
  38. cmd.CmdDump,
  39. cmd.CmdServ,
  40. cmd.CmdUpdate,
  41. }
  42. app.Flags = append(app.Flags, []cli.Flag{}...)
  43. app.Run(os.Args)
  44. }