Improved README for developers

This commit is contained in:
2019-08-27 17:45:18 +09:00
parent 49f67d3a49
commit 714d48ab3b
9 changed files with 105 additions and 150 deletions

View File

@ -1,17 +1,9 @@
# Makefile for Anime Notifier
GOCMD=@go
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install
# Constants
GOTEST=@./utils/test/go-test-color.sh
BUILDJOBS=@./jobs/build.sh
BUILDPATCHES=@./patches/build.sh
BUILDBOTS=@./bots/build.sh
TSCMD=@tsc
IPTABLES=@sudo iptables
IP6TABLES=@sudo ip6tables
PACK:=$(shell command -v pack 2> /dev/null)
RUN:=$(shell command -v run 2> /dev/null)
PACK=$(shell command -v pack 2> /dev/null)
RUN=$(shell command -v run 2> /dev/null)
SERVICEFILE=/etc/systemd/system/animenotifier.service
# Determine the name of the platform
@ -31,17 +23,15 @@ endif
# Build targets
server:
$(GOBUILD)
@go build
deps:
go mod download
jobs:
$(BUILDJOBS)
@./jobs/build.sh
bots:
$(BUILDBOTS)
@./bots/build.sh
patches:
$(BUILDPATCHES)
js:
$(TSCMD)
install:
$(GOINSTALL)
@./patches/build.sh
test:
$(GOTEST) github.com/animenotifier/notify.moe -v -cover
bench:
@ -64,7 +54,7 @@ service:
sudo systemctl daemon-reload
@echo -e "\nYou can now start the service using:\n\nsudo systemctl start animenotifier.service"
assets:
$(TSCMD)
@tsc
@pack
clean:
find . -type f | xargs file | grep "ELF.*executable" | awk -F: '{print $1}' | xargs rm
@ -72,10 +62,10 @@ clean:
rm -rf ./components
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
$(IP6TABLES) -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 4000
$(IP6TABLES) -t nat -A OUTPUT -o lo -p tcp --dport 443 -j REDIRECT --to-port 4001
@sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 4000
@sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 443 -j REDIRECT --to-port 4001
@sudo ip6tables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 4000
@sudo ip6tables -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 -