diff --git a/INSTALLATION.md b/INSTALLATION.md index a2fd8d31..6cfbec43 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -14,9 +14,13 @@ * `cd $GOPATH/src/github.com/animenotifier/notify.moe` * `make tools` to install [pack](https://github.com/aerogo/pack) & [run](https://github.com/aerogo/run) -* `make ports` to set up local port forwarding *(80 to 4000, 443 to 4001)* * `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` @@ -25,10 +29,6 @@ * Add `127.0.0.1 beta.notify.moe` to `/etc/hosts` -## Browser - -* Start Chrome via `google-chrome --ignore-certificate-errors` - ## Run * Start the web server in notify.moe directory: `run` diff --git a/makefile b/makefile index cb0dda73..32d09c38 100644 --- a/makefile +++ b/makefile @@ -9,6 +9,19 @@ BUILDPATCHES=@./patches/build.sh BUILDBOTS=@./bots/build.sh TSCMD=@tsc IPTABLES=@sudo iptables +OSNAME= + +ifeq ($(OS),Windows_NT) + OSNAME = WINDOWS +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + OSNAME = LINUX + endif + ifeq ($(UNAME_S),Darwin) + OSNAME = OSX + endif +endif server: $(GOBUILD) @@ -43,8 +56,20 @@ depslist: clean: find . -type f | xargs file | grep "ELF.*executable" | awk -F: '{print $1}' | xargs rm ports: +ifeq ($(OSNAME),LINUX) $(IPTABLES) -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 4000 $(IPTABLES) -t nat -A OUTPUT -o lo -p tcp --dport 443 -j REDIRECT --to-port 4001 +endif +ifeq ($(OSNAME),OSX) + @echo "rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 4001" | sudo pfctl -ef - +endif +browser: +ifeq ($(OSNAME),LINUX) + @google-chrome --ignore-certificate-errors +endif +ifeq ($(OSNAME),OSX) + @/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors +endif all: assets server bots jobs patches .PHONY: bots jobs patches ports