Merge pull request #47 from shxsun/master

add start.sh and start.bat  and python test init scripts
This commit is contained in:
Lunny Xiao 2014-03-31 16:29:09 +08:00
commit dd9fb807a4
8 changed files with 54 additions and 11 deletions

11
.gitignore vendored
View File

@ -1,9 +1,3 @@
<<<<<<< HEAD
gogs
*.exe
*.exe~
.DS_Store
*.db
*.log
@ -14,8 +8,6 @@ data/
*.iml
public/img/avatar/
=======
>>>>>>> b4db9f67548a41922f1b337daf9c9d2b975b55c4
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
@ -38,3 +30,6 @@ _cgo_export.*
_testmain.go
*.exe
*.exe~
gogs
__pycache__

View File

@ -6,3 +6,5 @@ filesets:
- LICENSE
- README.md
- README_ZH.md
- start.bat
- start.sh

2
start.bat Normal file
View File

@ -0,0 +1,2 @@
@echo off
gogs.exe web

6
start.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash -
#
# start gogs web
#
cd "$(dirname $0)"
./gogs web

9
tests/.travel.yml Normal file
View File

@ -0,0 +1,9 @@
command: go test -v {}
include: ^.+_test\.go$
path: ./
depth: 1
verbose: true
timeout: 1m
reload: false
html: test.html
notify: []

11
tests/README.md Normal file
View File

@ -0,0 +1,11 @@
## gogs test
this is for developers
## prepare environment
go get -u github.com/shxsun/travelexec
# start gogs server
gogs web
## start test
travelexec

17
tests/default_test.go Normal file
View File

@ -0,0 +1,17 @@
package test
import (
"net/http"
"testing"
)
func TestMain(t *testing.T) {
r, err := http.Get("http://localhost:3000/")
if err != nil {
t.Fatal(err)
}
defer r.Body.Close()
if r.StatusCode != http.StatusOK {
t.Error(r.StatusCode)
}
}

3
web.go
View File

@ -160,6 +160,7 @@ func runWeb(*cli.Context) {
base.Cfg.MustValue("server", "HTTP_PORT", "3000"))
log.Info("Listen: %s", listenAddr)
if err := http.ListenAndServe(listenAddr, m); err != nil {
log.Critical(err.Error())
fmt.Println(err.Error())
//log.Critical(err.Error()) // not working now
}
}