#3045 fix DEPRECATED Action signature erorr

This commit is contained in:
Unknwon 2016-05-12 14:32:28 -04:00
parent 8a2347592d
commit 7826eae452
10 changed files with 30 additions and 18 deletions

View file

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current version: 0.9.26 ##### Current version: 0.9.27
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

View file

@ -67,7 +67,7 @@ func pemBlockForKey(priv interface{}) *pem.Block {
} }
} }
func runCert(ctx *cli.Context) { func runCert(ctx *cli.Context) error {
if len(ctx.String("host")) == 0 { if len(ctx.String("host")) == 0 {
log.Fatal("Missing required --host parameter") log.Fatal("Missing required --host parameter")
} }
@ -158,4 +158,6 @@ func runCert(ctx *cli.Context) {
pem.Encode(keyOut, pemBlockForKey(priv)) pem.Encode(keyOut, pemBlockForKey(priv))
keyOut.Close() keyOut.Close()
log.Println("Written key.pem") log.Println("Written key.pem")
return nil
} }

View file

@ -20,7 +20,9 @@ var CmdCert = cli.Command{
Action: runCert, Action: runCert,
} }
func runCert(ctx *cli.Context) { func runCert(ctx *cli.Context) error {
fmt.Println("Command cert not available, please use build tags 'cert' to rebuild.") fmt.Println("Command cert not available, please use build tags 'cert' to rebuild.")
os.Exit(1) os.Exit(1)
return nil
} }

View file

@ -32,7 +32,7 @@ It can be used for backup and capture Gogs server image to send to maintainer`,
}, },
} }
func runDump(ctx *cli.Context) { func runDump(ctx *cli.Context) error {
if ctx.IsSet("config") { if ctx.IsSet("config") {
setting.CustomConf = ctx.String("config") setting.CustomConf = ctx.String("config")
} }
@ -68,21 +68,21 @@ func runDump(ctx *cli.Context) {
log.Fatalf("Fail to create %s: %v", fileName, err) log.Fatalf("Fail to create %s: %v", fileName, err)
} }
if err := z.AddFile("gogs-repo.zip", reposDump); err !=nil { if err := z.AddFile("gogs-repo.zip", reposDump); err != nil {
log.Fatalf("Fail to include gogs-repo.zip: %v", err) log.Fatalf("Fail to include gogs-repo.zip: %v", err)
} }
if err := z.AddFile("gogs-db.sql", dbDump); err !=nil { if err := z.AddFile("gogs-db.sql", dbDump); err != nil {
log.Fatalf("Fail to include gogs-db.sql: %v", err) log.Fatalf("Fail to include gogs-db.sql: %v", err)
} }
customDir, err := os.Stat(setting.CustomPath) customDir, err := os.Stat(setting.CustomPath)
if err == nil && customDir.IsDir() { if err == nil && customDir.IsDir() {
if err := z.AddDir("custom", setting.CustomPath); err !=nil { if err := z.AddDir("custom", setting.CustomPath); err != nil {
log.Fatalf("Fail to include custom: %v", err) log.Fatalf("Fail to include custom: %v", err)
} }
} else { } else {
log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath) log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath)
} }
if err := z.AddDir("log", setting.LogRootPath); err !=nil { if err := z.AddDir("log", setting.LogRootPath); err != nil {
log.Fatalf("Fail to include log: %v", err) log.Fatalf("Fail to include log: %v", err)
} }
// FIXME: SSH key file. // FIXME: SSH key file.
@ -94,4 +94,6 @@ func runDump(ctx *cli.Context) {
log.Printf("Removing tmp work dir: %s", TmpWorkDir) log.Printf("Removing tmp work dir: %s", TmpWorkDir)
os.RemoveAll(TmpWorkDir) os.RemoveAll(TmpWorkDir)
log.Printf("Finish dumping in file %s", fileName) log.Printf("Finish dumping in file %s", fileName)
return nil
} }

View file

@ -129,7 +129,7 @@ func handleUpdateTask(uuid string, user, repoUser *models.User, reponame string,
} }
} }
func runServ(c *cli.Context) { func runServ(c *cli.Context) error {
if c.IsSet("config") { if c.IsSet("config") {
setting.CustomConf = c.String("config") setting.CustomConf = c.String("config")
} }
@ -138,7 +138,7 @@ func runServ(c *cli.Context) {
if setting.SSH.Disabled { if setting.SSH.Disabled {
println("Gogs: SSH has been disabled") println("Gogs: SSH has been disabled")
return return nil
} }
if len(c.Args()) < 1 { if len(c.Args()) < 1 {
@ -149,7 +149,7 @@ func runServ(c *cli.Context) {
if len(cmd) == 0 { if len(cmd) == 0 {
println("Hi there, You've successfully authenticated, but Gogs does not provide shell access.") println("Hi there, You've successfully authenticated, but Gogs does not provide shell access.")
println("If this is unexpected, please log in with password and setup Gogs under another user.") println("If this is unexpected, please log in with password and setup Gogs under another user.")
return return nil
} }
verb, args := parseCmd(cmd) verb, args := parseCmd(cmd)
@ -290,4 +290,6 @@ func runServ(c *cli.Context) {
fail("Internal error", "UpdatePublicKey: %v", err) fail("Internal error", "UpdatePublicKey: %v", err)
} }
} }
return nil
} }

View file

@ -24,7 +24,7 @@ var CmdUpdate = cli.Command{
}, },
} }
func runUpdate(c *cli.Context) { func runUpdate(c *cli.Context) error {
if c.IsSet("config") { if c.IsSet("config") {
setting.CustomConf = c.String("config") setting.CustomConf = c.String("config")
} }
@ -33,7 +33,7 @@ func runUpdate(c *cli.Context) {
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
log.GitLogger.Trace("SSH_ORIGINAL_COMMAND is empty") log.GitLogger.Trace("SSH_ORIGINAL_COMMAND is empty")
return return nil
} }
args := c.Args() args := c.Args()
@ -53,4 +53,6 @@ func runUpdate(c *cli.Context) {
if err := models.AddUpdateTask(&task); err != nil { if err := models.AddUpdateTask(&task); err != nil {
log.GitLogger.Fatal(2, "AddUpdateTask: %v", err) log.GitLogger.Fatal(2, "AddUpdateTask: %v", err)
} }
return nil
} }

View file

@ -175,7 +175,7 @@ func newMacaron() *macaron.Macaron {
return m return m
} }
func runWeb(ctx *cli.Context) { func runWeb(ctx *cli.Context) error {
if ctx.IsSet("config") { if ctx.IsSet("config") {
setting.CustomConf = ctx.String("config") setting.CustomConf = ctx.String("config")
} }
@ -585,4 +585,6 @@ func runWeb(ctx *cli.Context) {
if err != nil { if err != nil {
log.Fatal(4, "Fail to start server: %v", err) log.Fatal(4, "Fail to start server: %v", err)
} }
return nil
} }

2
glide.lock generated
View file

@ -6,7 +6,7 @@ imports:
subpackages: subpackages:
- memcache - memcache
- name: github.com/codegangsta/cli - name: github.com/codegangsta/cli
version: aca5b047ed14d17224157c3434ea93bf6cdaadee version: 7f0ca9a34958d6702ac8f38530d19001fa5b1560
- name: github.com/go-macaron/binding - name: github.com/go-macaron/binding
version: a68f34212fe257219981e43adfe4c96ab48f42cd version: a68f34212fe257219981e43adfe4c96ab48f42cd
- name: github.com/go-macaron/cache - name: github.com/go-macaron/cache

View file

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.9.26.0511" const APP_VER = "0.9.27.0512"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View file

@ -1 +1 @@
0.9.26.0511 0.9.27.0512