1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-29 09:31:11 -05:00

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

View file

@ -6,3 +6,5 @@ filesets:
- LICENSE - LICENSE
- README.md - README.md
- README_ZH.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")) base.Cfg.MustValue("server", "HTTP_PORT", "3000"))
log.Info("Listen: %s", listenAddr) log.Info("Listen: %s", listenAddr)
if err := http.ListenAndServe(listenAddr, m); err != nil { if err := http.ListenAndServe(listenAddr, m); err != nil {
log.Critical(err.Error()) fmt.Println(err.Error())
//log.Critical(err.Error()) // not working now
} }
} }