Added installation script for developers
This commit is contained in:
parent
65a16ce809
commit
a7012b6e8d
@ -11,7 +11,7 @@
|
|||||||
* Install [TypeScript](https://www.typescriptlang.org/) (2.6 or higher)
|
* Install [TypeScript](https://www.typescriptlang.org/) (2.6 or higher)
|
||||||
* Install [Git LFS](https://git-lfs.github.com/)
|
* Install [Git LFS](https://git-lfs.github.com/)
|
||||||
|
|
||||||
## Check
|
## Confirm that prerequisites are installed
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go version
|
go version
|
||||||
@ -19,29 +19,13 @@ tsc --version
|
|||||||
git lfs 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
|
## Run the server
|
||||||
|
|
||||||
* `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
|
|
||||||
|
|
||||||
* Start the web server in notify.moe directory: `run`
|
* Start the web server in notify.moe directory: `run`
|
||||||
* Open `https://beta.notify.moe` which should now resolve to localhost
|
* Open `https://beta.notify.moe` which should now resolve to localhost
|
||||||
|
39
install.sh
39
install.sh
@ -1,7 +1,41 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# Clone and build main repository
|
||||||
go get -v github.com/animenotifier/notify.moe/...
|
go get -v github.com/animenotifier/notify.moe/...
|
||||||
|
go get -v github.com/stretchr/testify/assert
|
||||||
cd $GOPATH/src/github.com/animenotifier/notify.moe
|
cd $GOPATH/src/github.com/animenotifier/notify.moe
|
||||||
make all
|
make all
|
||||||
|
|
||||||
@ -10,4 +44,9 @@ git clone https://github.com/animenotifier/database ~/.aero/db/arn
|
|||||||
|
|
||||||
# Configure
|
# Configure
|
||||||
make ports
|
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"
|
sudo -- sh -c -e "echo '127.0.0.1 beta.notify.moe' >> /etc/hosts"
|
||||||
|
|
||||||
|
# Test
|
||||||
|
make test
|
@ -28,8 +28,12 @@ func TestRouteStatusCodes(t *testing.T) {
|
|||||||
// Record the response without actually starting the server
|
// Record the response without actually starting the server
|
||||||
responseRecorder := httptest.NewRecorder()
|
responseRecorder := httptest.NewRecorder()
|
||||||
app.Handler().ServeHTTP(responseRecorder, request)
|
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))
|
panic(fmt.Errorf("%s | Wrong status code | %v instead of %v", example, status, http.StatusOK))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user