Added installation script for developers

This commit is contained in:
Eduard Urbach 2018-04-10 12:37:59 +02:00
parent 65a16ce809
commit a7012b6e8d
3 changed files with 50 additions and 23 deletions

View File

@ -11,7 +11,7 @@
* Install [TypeScript](https://www.typescriptlang.org/) (2.6 or higher)
* Install [Git LFS](https://git-lfs.github.com/)
## Check
## Confirm that prerequisites are installed
```bash
go version
@ -19,29 +19,13 @@ tsc --version
git lfs version
```
## Download the repository
## Start the installation
* `go get github.com/animenotifier/notify.moe/...`
```bash
curl -s https://raw.githubusercontent.com/animenotifier/notify.moe/go/install.sh | sudo bash
```
## Build all
* `cd $GOPATH/src/github.com/animenotifier/notify.moe`
* `make all`
## Browser
* `make ports` to set up local port forwarding *(80 to 4000, 443 to 4001)*
* `make browser` to start Google Chrome
## Database
* `git clone https://github.com/animenotifier/database ~/.aero/db/arn`
## Hosts
* Add `127.0.0.1 beta.notify.moe` to `/etc/hosts`
## Run
## Run the server
* Start the web server in notify.moe directory: `run`
* Open `https://beta.notify.moe` which should now resolve to localhost

View File

@ -1,7 +1,41 @@
#!/bin/bash
echo "Checking prerequisites..."
if hash go 2>/dev/null; then
go version
else
echo "Go is not installed"
exit
fi
if hash tsc 2>/dev/null; then
tsc --version
else
echo "TypeScript is not installed"
exit
fi
if hash git 2>/dev/null; then
git version
else
echo "Git is not installed"
exit
fi
if hash git-lfs 2>/dev/null; then
git lfs version
else
echo "Git LFS is not installed"
exit
fi
echo "Looks like the prerequisites were installed correctly!"
echo "---"
# Clone and build main repository
go get -v github.com/animenotifier/notify.moe/...
go get -v github.com/stretchr/testify/assert
cd $GOPATH/src/github.com/animenotifier/notify.moe
make all
@ -10,4 +44,9 @@ git clone https://github.com/animenotifier/database ~/.aero/db/arn
# Configure
make ports
# Add "127.0.0.1 beta.notify.moe" to /etc/hosts
sudo -- sh -c -e "echo '127.0.0.1 beta.notify.moe' >> /etc/hosts"
# Test
make test

View File

@ -28,8 +28,12 @@ func TestRouteStatusCodes(t *testing.T) {
// Record the response without actually starting the server
responseRecorder := httptest.NewRecorder()
app.Handler().ServeHTTP(responseRecorder, request)
status := responseRecorder.Code
if status := responseRecorder.Code; status != http.StatusOK {
switch status {
case 200, 302:
// 200 and 302 are allowed
default:
panic(fmt.Errorf("%s | Wrong status code | %v instead of %v", example, status, http.StatusOK))
}
}