THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.go 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2016 The Gitea 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. // Gitea (git with a cup of tea) is a painless self-hosted Git Service.
  6. package main // import "code.gitea.io/gitea"
  7. import (
  8. "os"
  9. "strings"
  10. "code.gitea.io/gitea/cmd"
  11. "code.gitea.io/gitea/modules/log"
  12. "code.gitea.io/gitea/modules/setting"
  13. // register supported doc types
  14. _ "code.gitea.io/gitea/modules/markup/csv"
  15. _ "code.gitea.io/gitea/modules/markup/markdown"
  16. _ "code.gitea.io/gitea/modules/markup/orgmode"
  17. "github.com/urfave/cli"
  18. )
  19. // Version holds the current Gitea version
  20. var Version = "1.5.0-dev"
  21. // Tags holds the build tags used
  22. var Tags = ""
  23. func init() {
  24. setting.AppVer = Version
  25. setting.AppBuiltWith = formatBuiltWith(Tags)
  26. }
  27. func main() {
  28. app := cli.NewApp()
  29. app.Name = "Gitea"
  30. app.Usage = "A painless self-hosted Git service"
  31. app.Description = `By default, gitea will start serving using the webserver with no
  32. arguments - which can alternatively be run by running the subcommand web.`
  33. app.Version = Version + formatBuiltWith(Tags)
  34. app.Commands = []cli.Command{
  35. cmd.CmdWeb,
  36. cmd.CmdServ,
  37. cmd.CmdHook,
  38. cmd.CmdDump,
  39. cmd.CmdCert,
  40. cmd.CmdAdmin,
  41. cmd.CmdGenerate,
  42. }
  43. app.Flags = append(app.Flags, []cli.Flag{}...)
  44. app.Action = cmd.CmdWeb.Action
  45. err := app.Run(os.Args)
  46. if err != nil {
  47. log.Fatal(4, "Failed to run app with %s: %v", os.Args, err)
  48. }
  49. }
  50. func formatBuiltWith(Tags string) string {
  51. if len(Tags) == 0 {
  52. return ""
  53. }
  54. return " built with: " + strings.Replace(Tags, " ", ", ", -1)
  55. }