summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gopmfile7
-rw-r--r--.travis.yml4
-rw-r--r--README.md2
-rw-r--r--cmd/web.go11
-rw-r--r--docker/README.md6
-rw-r--r--docker/blocks/docker_gogs/Dockerfile2
-rw-r--r--docker/blocks/docker_gogs_dev/Dockerfile2
-rw-r--r--gogs.go2
-rw-r--r--models/repo.go25
-rw-r--r--models/user.go2
-rw-r--r--modules/setting/setting.go12
-rw-r--r--routers/admin/admin.go1
-rwxr-xr-xscripts/build.sh42
-rwxr-xr-xscripts/build_freebsd.sh27
-rwxr-xr-xscripts/build_linux64.sh46
-rw-r--r--templates/.VERSION2
-rw-r--r--templates/admin/config.tmpl4
17 files changed, 110 insertions, 87 deletions
diff --git a/.gopmfile b/.gopmfile
index 49b4171550..7fb407d165 100644
--- a/.gopmfile
+++ b/.gopmfile
@@ -6,9 +6,8 @@ github.com/beego/memcache = commit:2aea774416
github.com/beego/redigo = commit:856744a0d5
github.com/Unknwon/cae = commit:2e70a1351b
github.com/Unknwon/com =
-github.com/Unknwon/goconfig = commit:0f8d8dc1c0
github.com/Unknwon/i18n = commit:aec5f77857
-github.com/Unknwon/macaron = commit:3d307c1232
+github.com/Unknwon/macaron =
github.com/codegangsta/cli = commit:7381bc4e62
github.com/go-sql-driver/mysql = commit:8111ee3ec3
github.com/go-xorm/core = commit:3e0fa232ab
@@ -20,9 +19,9 @@ github.com/macaron-contrib/binding =
github.com/macaron-contrib/cache = commit:0bb9e6c9ef
github.com/macaron-contrib/captcha = commit:3567dc48b8
github.com/macaron-contrib/csrf = commit:422b79675c
-github.com/macaron-contrib/i18n = commit:184bb832f2
+github.com/macaron-contrib/i18n =
github.com/macaron-contrib/oauth2 = commit:8f394c3629
-github.com/macaron-contrib/session = commit:f00d48fd4f
+github.com/macaron-contrib/session =
github.com/macaron-contrib/toolbox = commit:57127bcc89
github.com/mattn/go-sqlite3 = commit:a80c27ba33
github.com/nfnt/resize = commit:581d15cb53
diff --git a/.travis.yml b/.travis.yml
index eb5732ff60..b060c69392 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,4 +2,6 @@ language: go
go:
- 1.2
- - 1.3 \ No newline at end of file
+ - 1.3
+
+sudo: false
diff --git a/README.md b/README.md
index 2b037b55cc..612f5172d4 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://travis-ci.org/gogits/gogs.svg?branch=master)](https://travis-ci.org/gogits/gogs)
=====================
+[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gogits/gogs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
Gogs(Go Git Service) is a painless self-hosted Git Service written in Go.
![Demo](https://gowalker.org/public/gogs_demo.gif)
diff --git a/cmd/web.go b/cmd/web.go
index 2251ea9218..ddb34829b7 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -74,11 +74,11 @@ func checkVersion() {
// Check dependency version.
checkers := []VerChecker{
- {"github.com/Unknwon/macaron", macaron.Version, "0.4.7"},
+ {"github.com/Unknwon/macaron", macaron.Version, "0.4.9"},
{"github.com/macaron-contrib/binding", binding.Version, "0.0.4"},
{"github.com/macaron-contrib/csrf", csrf.Version, "0.0.1"},
- {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.4"},
- {"github.com/macaron-contrib/session", session.Version, "0.1.0"},
+ {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.5"},
+ {"github.com/macaron-contrib/session", session.Version, "0.1.1"},
}
for _, c := range checkers {
ver := strings.Join(strings.Split(c.Version(), ".")[:3], ".")
@@ -133,10 +133,7 @@ func newMacaron() *macaron.Macaron {
m.Use(captcha.Captchaer(captcha.Options{
SubURL: setting.AppSubUrl,
}))
- m.Use(session.Sessioner(session.Options{
- Provider: setting.SessionProvider,
- Config: *setting.SessionConfig,
- }))
+ m.Use(session.Sessioner(setting.SessionConfig))
m.Use(csrf.Csrfer(csrf.Options{
Secret: setting.SecretKey,
SetCookie: true,
diff --git a/docker/README.md b/docker/README.md
index 448912009c..9f82cf7626 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -30,7 +30,7 @@ The `config` file contains lines which will in the gogs docker container end up
Here you can define things like the MySQL server for your database block.
The `fig` file will just be added to `fig.yml`, which is used by fig to manage your containers.
-This inculdes container linking!
+This includes container linking!
Just have a look at them and it will be clear how to write your own blocks.
@@ -53,7 +53,7 @@ Example:
More sophisticated Example
--------------------------
-Her is a more elaborated example
+Here is a more elaborated example
```sh
./assemble_blocks.sh docker_gogs w_db_cache_session option_db_postgresql option_cache_redis option_session_mysql
@@ -86,4 +86,4 @@ This will pull in the `Dockerfile` from `docker_gogs` instead of the one from `d
`Dockerfile`s for the `master` and `dev` branch are provided as `docker_gogs` and `docker_gogs_dev`
-[fig]:http://www.fig.sh/ \ No newline at end of file
+[fig]:http://www.fig.sh/
diff --git a/docker/blocks/docker_gogs/Dockerfile b/docker/blocks/docker_gogs/Dockerfile
index e2e056ae02..2c98cc5011 100644
--- a/docker/blocks/docker_gogs/Dockerfile
+++ b/docker/blocks/docker_gogs/Dockerfile
@@ -46,7 +46,7 @@ ENV HOME /home/git
ENV USER git
ENV PATH $GOGS_PATH:$PATH
-RUN git config --global user.name "GoGS"
+RUN git config --global user.name "GoGS" && git config --global user.email "gogitservice@gmail.com"
ENTRYPOINT ["/tmp/init_gogs.sh"]
CMD ["gogs", "web"]
diff --git a/docker/blocks/docker_gogs_dev/Dockerfile b/docker/blocks/docker_gogs_dev/Dockerfile
index d1b96bf4a2..2a628c2d5e 100644
--- a/docker/blocks/docker_gogs_dev/Dockerfile
+++ b/docker/blocks/docker_gogs_dev/Dockerfile
@@ -47,7 +47,7 @@ ENV HOME /home/git
ENV USER git
ENV PATH $GOGS_PATH:$PATH
-RUN git config --global user.name "GoGS"
+RUN git config --global user.name "GoGS" && git config --global user.email "gogitservice@gmail.com"
ENTRYPOINT ["/tmp/init_gogs.sh"]
CMD ["gogs", "web"]
diff --git a/gogs.go b/gogs.go
index 04141dad3d..c3038aad6d 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.5.10.1222 Beta"
+const APP_VER = "0.5.10.1229 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/models/repo.go b/models/repo.go
index 3ea4efc7f0..50b2b3fc25 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -105,21 +105,18 @@ func NewRepoContext() {
log.Fatal(4, "Gogs requires Git version greater or equal to 1.7.1")
}
- // Check if server has basic git setting and set if not.
- if stdout, stderr, err := process.Exec("NewRepoContext(get setting)", "git", "config", "--get", "user.name"); err != nil || strings.TrimSpace(stdout) == "" {
- // ExitError indicates user.name is not set
- if _, ok := err.(*exec.ExitError); ok || strings.TrimSpace(stdout) == "" {
- stndrdUserName := "Gogs"
- stndrdUserEmail := "gogitservice@gmail.com"
- if _, stderr, gerr := process.Exec("NewRepoContext(set name)", "git", "config", "--global", "user.name", stndrdUserName); gerr != nil {
- log.Fatal(4, "Fail to set git user.name(%s): %s", gerr, stderr)
- }
- if _, stderr, gerr := process.Exec("NewRepoContext(set email)", "git", "config", "--global", "user.email", stndrdUserEmail); gerr != nil {
- log.Fatal(4, "Fail to set git user.email(%s): %s", gerr, stderr)
+ // Check if server has user.email and user.name set correctly and set if they're not.
+ for configKey, defaultValue := range map[string]string{"user.name": "Gogs", "user.email": "gogitservice@gmail.com"} {
+ if stdout, stderr, err := process.Exec("NewRepoContext(get setting)", "git", "config", "--get", configKey); err != nil || strings.TrimSpace(stdout) == "" {
+ // ExitError indicates this config is not set
+ if _, ok := err.(*exec.ExitError); ok || strings.TrimSpace(stdout) == "" {
+ if _, stderr, gerr := process.Exec("NewRepoContext(set "+configKey+")", "git", "config", "--global", configKey, defaultValue); gerr != nil {
+ log.Fatal(4, "Fail to set git %s(%s): %s", configKey, gerr, stderr)
+ }
+ log.Info("Git config %s set to %s", configKey, defaultValue)
+ } else {
+ log.Fatal(4, "Fail to get git %s(%s): %s", configKey, err, stderr)
}
- log.Info("Git user.name and user.email set to %s <%s>", stndrdUserName, stndrdUserEmail)
- } else {
- log.Fatal(4, "Fail to get git user.name(%s): %s", err, stderr)
}
}
diff --git a/models/user.go b/models/user.go
index 651168eba2..f16fbca344 100644
--- a/models/user.go
+++ b/models/user.go
@@ -453,7 +453,7 @@ func ChangeUserName(u *User, newUserName string) (err error) {
// UpdateUser updates user's information.
func UpdateUser(u *User) error {
- has, err := x.Where("id!=?", u.Id).And("email=?", u.Email).Get(new(User))
+ has, err := x.Where("id!=?", u.Id).And("type=?", INDIVIDUAL).And("email=?", u.Email).Get(new(User))
if err != nil {
return err
} else if has {
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 76e1ab7696..cda50b8e98 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -104,8 +104,7 @@ var (
EnableMemcache bool
// Session settings.
- SessionProvider string
- SessionConfig *session.Config
+ SessionConfig session.Options
// Git settings.
MaxGitDiffLines int
@@ -412,22 +411,15 @@ func newCacheService() {
}
func newSessionService() {
- SessionProvider = Cfg.MustValueRange("session", "PROVIDER", "memory",
+ SessionConfig.Provider = Cfg.MustValueRange("session", "PROVIDER", "memory",
[]string{"memory", "file", "redis", "mysql"})
-
- SessionConfig = new(session.Config)
SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ")
SessionConfig.CookieName = Cfg.MustValue("session", "COOKIE_NAME", "i_like_gogits")
SessionConfig.CookiePath = AppSubUrl
SessionConfig.Secure = Cfg.MustBool("session", "COOKIE_SECURE")
- SessionConfig.EnableSetCookie = Cfg.MustBool("session", "ENABLE_SET_COOKIE", true)
SessionConfig.Gclifetime = Cfg.MustInt64("session", "GC_INTERVAL_TIME", 86400)
SessionConfig.Maxlifetime = Cfg.MustInt64("session", "SESSION_LIFE_TIME", 86400)
- if SessionProvider == "file" {
- os.MkdirAll(path.Dir(SessionConfig.ProviderConfig), os.ModePerm)
- }
-
log.Info("Session Service Enabled")
}
diff --git a/routers/admin/admin.go b/routers/admin/admin.go
index 99bae8819a..563a9cdc41 100644
--- a/routers/admin/admin.go
+++ b/routers/admin/admin.go
@@ -202,7 +202,6 @@ func Config(ctx *middleware.Context) {
ctx.Data["CacheInternal"] = setting.CacheInternal
ctx.Data["CacheConn"] = setting.CacheConn
- ctx.Data["SessionProvider"] = setting.SessionProvider
ctx.Data["SessionConfig"] = setting.SessionConfig
ctx.Data["PictureService"] = setting.PictureService
diff --git a/scripts/build.sh b/scripts/build.sh
index 03b8077bf7..ea43bdafcb 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -1,21 +1,25 @@
-rm -rf output
-mkdir output
+outPath=./output
+
+rm -rf $outPath
+mkdir $outPath
+
go build ../gogs.go
chmod +x gogs
-mv gogs ./output/
-cp -r ../conf/ ./output/conf/
-cp -r ../custom/ ./output/custom/
-cp -r ./dockerfiles/ ./output/dockerfiles/
-cp -r ../public/ ./output/public/
-cp -r ../templates/ ./output/templates/
-cp ../cert.pem ./output/
-cp ../CONTRIBUTING.md ./output/
-cp gogs_supervisord.sh ./output/
-cp ../key.pem ./output/
-cp ../LICENSE ./output/
-cp ../README.md ./output/
-cp ../README_ZH.md ./output/
-cp start.bat ./output/
-cp start.sh ./output/
-cp ../wercker.yml ./output/
-cp mysql.sql ./output/
+mv gogs $outPath/
+
+cp -r ../conf/ $outPath/conf/
+cp -r ../custom/ $outPath/custom/
+cp -r dockerfiles/ $outPath/dockerfiles/
+cp -r ../public/ $outPath/public/
+cp -r ../templates/ $outPath/templates/
+cp ../cert.pem $outPath/
+cp ../CONTRIBUTING.md $outPath/
+cp gogs_supervisord.sh $outPath/
+cp ../key.pem $outPath/
+cp ../LICENSE $outPath/
+cp ../README.md $outPath/
+cp ../README_ZH.md $outPath/
+cp start.bat $outPath/
+cp start.sh $outPath/
+cp ../wercker.yml $outPath/
+cp mysql.sql $outPath/ \ No newline at end of file
diff --git a/scripts/build_freebsd.sh b/scripts/build_freebsd.sh
new file mode 100755
index 0000000000..b53c6ac0d5
--- /dev/null
+++ b/scripts/build_freebsd.sh
@@ -0,0 +1,27 @@
+outPlattform=freebsd
+outArch=amd64
+outPath=./output_$outPlattform_$outArch
+
+rm -rf $outPath
+mkdir $outPath
+
+CGO_ENABLED=0 GOOS=$outPlattform GOARCH=$outArch go build ../gogs.go
+chmod +x gogs
+mv gogs $outPath/
+
+cp -r ../conf/ $outPath/conf/
+cp -r ../custom/ $outPath/custom/
+cp -r dockerfiles/ $outPath/dockerfiles/
+cp -r ../public/ $outPath/public/
+cp -r ../templates/ $outPath/templates/
+cp ../cert.pem $outPath/
+cp ../CONTRIBUTING.md $outPath/
+cp gogs_supervisord.sh $outPath/
+cp ../key.pem $outPath/
+cp ../LICENSE $outPath/
+cp ../README.md $outPath/
+cp ../README_ZH.md $outPath/
+cp start.bat $outPath/
+cp start.sh $outPath/
+cp ../wercker.yml $outPath/
+cp mysql.sql $outPath/ \ No newline at end of file
diff --git a/scripts/build_linux64.sh b/scripts/build_linux64.sh
index eb6c04e579..528fc54cf0 100755
--- a/scripts/build_linux64.sh
+++ b/scripts/build_linux64.sh
@@ -1,21 +1,27 @@
-rm -rf output_linux_64
-mkdir output_linux_64
-CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ../gogs.go
+outPlattform=linux
+outArch=amd64
+outPath=./output_$outPlattform_$outArch
+
+rm -rf $outPath
+mkdir $outPath
+
+CGO_ENABLED=0 GOOS=$outPlattform GOARCH=$outArch go build ../gogs.go
chmod +x gogs
-mv gogs ./output_linux_64/
-cp -r ../conf/ ./output_linux_64/conf/
-cp -r ../custom/ ./output_linux_64/custom/
-cp -r dockerfiles/ ./output_linux_64/dockerfiles/
-cp -r ../public/ ./output_linux_64/public/
-cp -r ../templates/ ./output_linux_64/templates/
-cp ../cert.pem ./output_linux_64/
-cp ../CONTRIBUTING.md ./output_linux_64/
-cp gogs_supervisord.sh ./output_linux_64/
-cp ../key.pem ./output_linux_64/
-cp ../LICENSE ./output_linux_64/
-cp ../README.md ./output_linux_64/
-cp ../README_ZH.md ./output_linux_64/
-cp start.bat ./output_linux_64/
-cp start.sh ./output_linux_64/
-cp ../wercker.yml ./output_linux_64/
-cp mysql.sql ./output_linux_64/ \ No newline at end of file
+mv gogs $outPath/
+
+cp -r ../conf/ $outPath/conf/
+cp -r ../custom/ $outPath/custom/
+cp -r dockerfiles/ $outPath/dockerfiles/
+cp -r ../public/ $outPath/public/
+cp -r ../templates/ $outPath/templates/
+cp ../cert.pem $outPath/
+cp ../CONTRIBUTING.md $outPath/
+cp gogs_supervisord.sh $outPath/
+cp ../key.pem $outPath/
+cp ../LICENSE $outPath/
+cp ../README.md $outPath/
+cp ../README_ZH.md $outPath/
+cp start.bat $outPath/
+cp start.sh $outPath/
+cp ../wercker.yml $outPath/
+cp mysql.sql $outPath/ \ No newline at end of file
diff --git a/templates/.VERSION b/templates/.VERSION
index 801600a4bd..ea5da339f7 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.5.10.1222 Beta \ No newline at end of file
+0.5.10.1229 Beta \ No newline at end of file
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl
index 3ccb106bc4..9dd25081ac 100644
--- a/templates/admin/config.tmpl
+++ b/templates/admin/config.tmpl
@@ -169,13 +169,11 @@
<div class="panel-body">
<dl class="dl-horizontal admin-dl-horizontal">
<dt>{{.i18n.Tr "admin.config.session_provider"}}</dt>
- <dd>{{.SessionProvider}}</dd>
+ <dd>{{.SessionConfig.Provider}}</dd>
<dt>{{.i18n.Tr "admin.config.provider_config"}}</dt>
<dd><pre>{{.SessionConfig.ProviderConfig}}</pre></dd>
<dt>{{.i18n.Tr "admin.config.cookie_name"}}</dt>
<dd>{{.SessionConfig.CookieName}}</dd>
- <dt>{{.i18n.Tr "admin.config.enable_set_cookie"}}</dt>
- <dd><i class="fa fa{{if .SessionConfig.EnableSetCookie}}-check{{end}}-square-o"></i></dd>
<dt>{{.i18n.Tr "admin.config.gc_interval_time"}}</dt>
<dd>{{.SessionConfig.Gclifetime}} {{.i18n.Tr "tool.raw_seconds"}}</dd>
<dt>{{.i18n.Tr "admin.config.session_life_time"}}</dt>