From fc18741cc78acbb6fac5cf89fa5ae7034178c5ca Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 7 Oct 2014 07:02:53 -0400 Subject: [PATCH] Fix #524 --- .bra.toml | 4 ++-- .gobuild.yml | 4 ++-- cmd/cert.go | 2 ++ cmd/cert_stub.go | 34 ++++++++++++++++++++++++++++++++++ gogs.go | 2 +- templates/.VERSION | 2 +- 6 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 cmd/cert_stub.go diff --git a/.bra.toml b/.bra.toml index a5fcdf6ee5..df2e10e6ff 100644 --- a/.bra.toml +++ b/.bra.toml @@ -11,7 +11,7 @@ watch_dirs = [ watch_exts = [".go", ".ini"] build_delay = 1500 cmds = [ - ["go", "install", "-tags", "sqlite"], - ["go", "build", "-tags", "sqlite"], + ["go", "install", "-tags", "sqlite cert"], + ["go", "build", "-tags", "sqlite cert"], ["./gogs", "web"] ] \ No newline at end of file diff --git a/.gobuild.yml b/.gobuild.yml index 77633fa00d..3a2f361d56 100644 --- a/.gobuild.yml +++ b/.gobuild.yml @@ -16,6 +16,6 @@ settings: then go install -v else - go get -v -tags "sqlite redis memcache" github.com/gogits/gogs - go install -v -tags "sqlite redis memcache" + go get -v -tags "sqlite redis memcache cert" github.com/gogits/gogs + go install -v -tags "sqlite redis memcache cert" fi diff --git a/cmd/cert.go b/cmd/cert.go index b693b7d94e..631c4c6823 100644 --- a/cmd/cert.go +++ b/cmd/cert.go @@ -1,3 +1,5 @@ +// +build cert + // Copyright 2009 The Go Authors. All rights reserved. // Copyright 2014 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style diff --git a/cmd/cert_stub.go b/cmd/cert_stub.go new file mode 100644 index 0000000000..2029f4cbce --- /dev/null +++ b/cmd/cert_stub.go @@ -0,0 +1,34 @@ +// +build !cert + +// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2014 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. +package cmd + +import ( + "fmt" + "time" + + "github.com/codegangsta/cli" +) + +var CmdCert = cli.Command{ + Name: "cert", + Usage: "Generate self-signed certificate", + Description: `Generate a self-signed X.509 certificate for a TLS server. +Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`, + Action: runCert, + Flags: []cli.Flag{ + cli.StringFlag{"host", "", "Comma-separated hostnames and IPs to generate a certificate for", ""}, + cli.StringFlag{"ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", ""}, + cli.IntFlag{"rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set", ""}, + cli.StringFlag{"start-date", "", "Creation date formatted as Jan 1 15:04:05 2011", ""}, + cli.DurationFlag{"duration", 365 * 24 * time.Hour, "Duration that certificate is valid for", ""}, + cli.BoolFlag{"ca", "whether this cert should be its own Certificate Authority", ""}, + }, +} + +func runCert(ctx *cli.Context) { + fmt.Println("Command cert not available, please use build tags 'cert' to rebuild.") +} diff --git a/gogs.go b/gogs.go index 43705061c9..b1e46096a8 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.5.1006 Beta" +const APP_VER = "0.5.5.1007 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/templates/.VERSION b/templates/.VERSION index e551dcfe40..999f683bf8 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.5.1006 Beta \ No newline at end of file +0.5.5.1007 Beta \ No newline at end of file