Browse Source

Merge pull request #47 from shxsun/master

add start.sh and start.bat  and python test init scripts
for-closed-social
Lunny Xiao 10 years ago
parent
commit
dd9fb807a4
8 changed files with 54 additions and 11 deletions
  1. +4
    -9
      .gitignore
  2. +3
    -1
      .gobuild.yml
  3. +2
    -0
      start.bat
  4. +6
    -0
      start.sh
  5. +9
    -0
      tests/.travel.yml
  6. +11
    -0
      tests/README.md
  7. +17
    -0
      tests/default_test.go
  8. +2
    -1
      web.go

+ 4
- 9
.gitignore 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
@ -37,4 +29,7 @@ _cgo_export.*
_testmain.go
*.exe
*.exe
*.exe~
gogs
__pycache__

+ 3
- 1
.gobuild.yml View File

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

+ 2
- 0
start.bat View File

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

+ 6
- 0
start.sh View File

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

+ 9
- 0
tests/.travel.yml 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
- 0
tests/README.md 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
- 0
tests/default_test.go 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)
}
}

+ 2
- 1
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
}
}

Loading…
Cancel
Save