From 714d48ab3b2151570611dadf988739123f4b5a64 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 27 Aug 2019 17:45:18 +0900 Subject: [PATCH] Improved README for developers --- CONTRIBUTING.md | 29 +++---- README.md | 77 ++++--------------- README.src.md | 59 +++----------- arn/README.md | 6 +- .../docker-compose.yml | 0 go.mod | 2 + go.sum | 35 +++++++++ makefile | 38 ++++----- tools/tools.go | 9 +++ 9 files changed, 105 insertions(+), 150 deletions(-) rename docker-compose.yml => docker/docker-compose.yml (100%) create mode 100644 tools/tools.go diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f63c228..26614de1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,24 +1,25 @@ # Contributing -## Links +## How can I help the project? -- [Installation](README.md#installation) -- [Task for new contributors](docs/new-contributor-task.md) -- [Issues](https://github.com/animenotifier/notify.moe/projects/10) -- [Code Style](https://github.com/akyoto/quality/blob/master/STYLE.md) +You do not need to be a developer to contribute. There are multiple ways to help our project: -## Communication +- [Database Editing](https://notify.moe/users/editors) +- [Donations](https://github.com/users/akyoto/sponsorship) +- [Pull Requests](https://github.com/animenotifier/notify.moe/pulls) -Please get in contact with the team on the [notify.moe Discord](https://discord.gg/0kimAmMCeXGXuzNF). -We are willing to help with installations and how to get started with contributions. -There are no stupid questions so feel free to ask anything if you encounter any troubles. +## How do I make a proper pull request? -## Installation +- Fork the project on GitHub +- Create a new branch +- Upload the changes to your branch +- Check the [style guidelines](https://github.com/akyoto/quality/blob/master/STYLE.md) +- Create a pull request -If you'd like to install this project locally, take a look at the [Installation](README.md#installation) guide. +## What if I already made a pull request but want to add more commits? -### Youtube guide +If you correctly created a new branch for your changes, you can simply upload the new commits to your fork and they will automatically appear in the PR. -You can take a look at this Youtube video if you're interested in contributing: +## How can I get in contact with the team? -[![notify.moe Source Code Guide](https://i1.ytimg.com/vi/c6e-F51e_8w/maxresdefault.jpg)](https://www.youtube.com/watch?v=c6e-F51e_8w&=&t=3m42s) +Join our [Discord server](discord.gg/0kimAmMCeXGXuzNF). diff --git a/README.md b/README.md index 17e5866b..7dc8521e 100644 --- a/README.md +++ b/README.md @@ -6,49 +6,26 @@ [![Coverage][coverage-image]][coverage-url] [![Sponsor][sponsor-image]][sponsor-url] -## How to +## Prerequisites -### Prerequisites +* Install [Go](https://golang.org/) +* Install [TypeScript](https://www.typescriptlang.org/) -* Install [Docker](https://www.docker.com/get-started) -* Install [Docker Compose](https://docs.docker.com/compose/install/) - -### Installation - -Download the source code: +## Installation ```shell -git clone https://github.com/animenotifier/notify.moe.git && cd notify.moe +git clone https://github.com/animenotifier/notify.moe.git +cd notify.moe +make tools +make assets +go build +./notify.moe ``` -Download the developer tools: - -```shell -docker pull animenotifier/notify.moe -``` - -Start the developer tools: - -```shell -docker-compose up -d -``` - -Attach to a terminal: - -```shell -docker attach notify.moe -``` - -### Start the server - -* Enter the notify.moe directory: `cd notify.moe` -* Download dependencies: `go mod download` -* Compile TypeScript files using: `tsc` -* Start the web server using: `run` - ### Networking * Add `beta.notify.moe 127.0.0.1` to your `hosts` file +* Run `make ports` ### In your browser @@ -56,39 +33,17 @@ docker attach notify.moe * Import the file `security/default/root.crt` as a trusted Root authority * Open `https://beta.notify.moe` -### Tips +## What now? -* You can detach from the terminal using `Ctrl P -> Ctrl Q`. -* If you need to shutdown everything, use `docker-compose down`. -* Your home directory is mounted as `/my` inside Docker. -* Fork the notify.moe repository and upload your changes to the fork. -* Clone all the repositories you use into a `projects` directory inside your home files. -* The `run` binary is a file watcher that will restart the web server when it detects code changes. -* File modification events [don't work](https://github.com/docker/for-win/issues/56) on Docker for Windows. -* Use an editor like [Visual Studio Code](http://code.visualstudio.com) to access the source code on the host. -* To automatically compile TypeScript files in VS Code, press `Ctrl Shift B` and select `tsc: watch`. -* Use a Linux system for maximum performance. - -### What now? - -* Try the [example task for newcomers](docs/new-contributor-task.md). -* Install Pug/Jade and Stylus extensions for your editor. -* If you're **not** using VS Code, map Pug/Jade to `.pixy` and Stylus to `.scarlet` files (they're similar). -* Make some changes and upload them to your fork. -* Create a pull request on this repository (with the diffs of your fork). +Take a look at [how to contribute](https://github.com/animenotifier/notify.moe/blob/go/CONTRIBUTING.md) to this project. ## Find us * [Discord](https://discord.gg/0kimAmMCeXGXuzNF) * [Facebook](https://www.facebook.com/animenotifier) * [Twitter](https://twitter.com/animenotifier) -* [Docker](https://hub.docker.com/r/animenotifier/notify.moe) * [GitHub](https://github.com/animenotifier/notify.moe) -## Contributing - -Please read [CONTRIBUTING.md](https://github.com/animenotifier/notify.moe/blob/go/CONTRIBUTING.md) for details on how to contribute to this project. - ## Statistics ![Uptime (30 days)](https://img.shields.io/uptimerobot/ratio/m777678498-177cb6b2990056768877bc2a.svg) @@ -102,9 +57,9 @@ Please take a look at the [style guidelines](https://github.com/akyoto/quality/b ## Sponsors -| [![Max Räche](https://avatars3.githubusercontent.com/u/39157397?s=70&v=4)](https://github.com/yukinamida) | [![Cedric Fung](https://avatars3.githubusercontent.com/u/2269238?s=70&v=4)](https://github.com/cedricfung) | [![Scott Rayapoullé](https://avatars3.githubusercontent.com/u/11772084?s=70&v=4)](https://github.com/soulcramer) | [![Eduard Urbach](https://avatars3.githubusercontent.com/u/438936?s=70&v=4)](https://eduardurbach.com) | -| --- | --- | --- | --- | -| [Max Räche](https://github.com/yukinamida) | [Cedric Fung](https://github.com/cedricfung) | [Scott Rayapoullé](https://github.com/soulcramer) | [Eduard Urbach](https://eduardurbach.com) | +| [![Cedric Fung](https://avatars3.githubusercontent.com/u/2269238?s=70&v=4)](https://github.com/cedricfung) | [![Scott Rayapoullé](https://avatars3.githubusercontent.com/u/11772084?s=70&v=4)](https://github.com/soulcramer) | [![Eduard Urbach](https://avatars3.githubusercontent.com/u/438936?s=70&v=4)](https://eduardurbach.com) | +| --- | --- | --- | +| [Cedric Fung](https://github.com/cedricfung) | [Scott Rayapoullé](https://github.com/soulcramer) | [Eduard Urbach](https://eduardurbach.com) | Want to see [your own name here?](https://github.com/users/akyoto/sponsorship) diff --git a/README.src.md b/README.src.md index 2eef9f30..ece47d21 100644 --- a/README.src.md +++ b/README.src.md @@ -6,45 +6,24 @@ ### Prerequisites -* Install [Docker](https://www.docker.com/get-started) -* Install [Docker Compose](https://docs.docker.com/compose/install/) +* Install [Go](https://golang.org/) +* Install [TypeScript](https://www.typescriptlang.org/) ### Installation -Download the source code: - ```shell -git clone https://github.com/animenotifier/notify.moe.git && cd notify.moe +git clone https://github.com/animenotifier/notify.moe.git +cd notify.moe +make tools +make assets +go build +./notify.moe ``` -Download the developer tools: - -```shell -docker pull animenotifier/notify.moe -``` - -Start the developer tools: - -```shell -docker-compose up -d -``` - -Attach to a terminal: - -```shell -docker attach notify.moe -``` - -### Start the server - -* Enter the notify.moe directory: `cd notify.moe` -* Download dependencies: `go mod download` -* Compile TypeScript files using: `tsc` -* Start the web server using: `run` - ### Networking * Add `beta.notify.moe 127.0.0.1` to your `hosts` file +* Run `make ports` ### In your browser @@ -52,33 +31,17 @@ docker attach notify.moe * Import the file `security/default/root.crt` as a trusted Root authority * Open `https://beta.notify.moe` -### Tips - -* You can detach from the terminal using `Ctrl P -> Ctrl Q`. -* If you need to shutdown everything, use `docker-compose down`. -* Your home directory is mounted as `/my` inside Docker. -* Fork the notify.moe repository and upload your changes to the fork. -* Clone all the repositories you use into a `projects` directory inside your home files. -* The `run` binary is a file watcher that will restart the web server when it detects code changes. -* File modification events [don't work](https://github.com/docker/for-win/issues/56) on Docker for Windows. -* Use an editor like [Visual Studio Code](http://code.visualstudio.com) to access the source code on the host. -* To automatically compile TypeScript files in VS Code, press `Ctrl Shift B` and select `tsc: watch`. -* Use a Linux system for maximum performance. - ### What now? * Try the [example task for newcomers](docs/new-contributor-task.md). -* Install Pug/Jade and Stylus extensions for your editor. -* If you're **not** using VS Code, map Pug/Jade to `.pixy` and Stylus to `.scarlet` files (they're similar). -* Make some changes and upload them to your fork. -* Create a pull request on this repository (with the diffs of your fork). +* Make some changes and upload them to a new branch on your fork. +* Create a pull request on this repository. ## Find us * [Discord](https://discord.gg/0kimAmMCeXGXuzNF) * [Facebook](https://www.facebook.com/animenotifier) * [Twitter](https://twitter.com/animenotifier) -* [Docker](https://hub.docker.com/r/animenotifier/notify.moe) * [GitHub](https://github.com/animenotifier/notify.moe) ## Contributing diff --git a/arn/README.md b/arn/README.md index 8c0eb45a..e73919b7 100644 --- a/arn/README.md +++ b/arn/README.md @@ -14,9 +14,9 @@ Please take a look at the [style guidelines](https://github.com/akyoto/quality/b ## Sponsors -| [![Max Räche](https://avatars3.githubusercontent.com/u/39157397?s=70&v=4)](https://github.com/yukinamida) | [![Cedric Fung](https://avatars3.githubusercontent.com/u/2269238?s=70&v=4)](https://github.com/cedricfung) | [![Scott Rayapoullé](https://avatars3.githubusercontent.com/u/11772084?s=70&v=4)](https://github.com/soulcramer) | [![Eduard Urbach](https://avatars3.githubusercontent.com/u/438936?s=70&v=4)](https://eduardurbach.com) | -| --- | --- | --- | --- | -| [Max Räche](https://github.com/yukinamida) | [Cedric Fung](https://github.com/cedricfung) | [Scott Rayapoullé](https://github.com/soulcramer) | [Eduard Urbach](https://eduardurbach.com) | +| [![Cedric Fung](https://avatars3.githubusercontent.com/u/2269238?s=70&v=4)](https://github.com/cedricfung) | [![Scott Rayapoullé](https://avatars3.githubusercontent.com/u/11772084?s=70&v=4)](https://github.com/soulcramer) | [![Eduard Urbach](https://avatars3.githubusercontent.com/u/438936?s=70&v=4)](https://eduardurbach.com) | +| --- | --- | --- | +| [Cedric Fung](https://github.com/cedricfung) | [Scott Rayapoullé](https://github.com/soulcramer) | [Eduard Urbach](https://eduardurbach.com) | Want to see [your own name here?](https://github.com/users/akyoto/sponsorship) diff --git a/docker-compose.yml b/docker/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to docker/docker-compose.yml diff --git a/go.mod b/go.mod index f687a241..2415c700 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,8 @@ require ( github.com/aerogo/markdown v0.1.9 github.com/aerogo/mirror v0.2.4 github.com/aerogo/nano v0.3.4 + github.com/aerogo/pack v0.6.1 + github.com/aerogo/run v1.0.2 github.com/aerogo/session-store-nano v0.1.7 github.com/aerogo/sitemap v0.1.3 github.com/akyoto/assert v0.2.0 diff --git a/go.sum b/go.sum index bece61a8..d225b041 100644 --- a/go.sum +++ b/go.sum @@ -20,6 +20,8 @@ github.com/aerogo/api v0.2.0 h1:mIc/y381e+Qc85eSc2cKPdpDDOmT0hlnEeCw2Dcf7no= github.com/aerogo/api v0.2.0/go.mod h1:6objJn5XiKpYpywQUPrFjxZIXD4NVI2LwcBNYCEcS3Y= github.com/aerogo/cluster v0.1.8 h1:N/jU2t7kQfKjXzQIArBQvtNkJCiaP9+jgdEid3P2Omc= github.com/aerogo/cluster v0.1.8/go.mod h1:ldxff0R9VPbm1yoZdkCrVYWroflgmwh+g6EM8+jFXyE= +github.com/aerogo/codetree v1.2.9 h1:Z01dFVK1Y5R8xF+9vnImtOQ05moEGs7XFNXlQIX28RY= +github.com/aerogo/codetree v1.2.9/go.mod h1:yMnyg3ZbbX5Jhyg6+BZK0LRFd3Vyf1eHREgNqC3CBfE= github.com/aerogo/crawler v0.2.5 h1:tsaRViwBKNJAotzjEmGOln7quzka4f0goiEZVg4Fdxc= github.com/aerogo/crawler v0.2.5/go.mod h1:nyFPwxOFm3gy5cvif8rG1ogXO0fTDVrxsQHwicJz1F8= github.com/aerogo/csp v0.1.6 h1:C2OpzPZHY1S5H+Dz0Or+YgVSfXT36avJw9e1smrIWUY= @@ -52,8 +54,18 @@ github.com/aerogo/mirror v0.2.4 h1:FOCoRC4ncZaMvGal6Cfg8hW7zvFSg/kSUlg4l2r9BEs= github.com/aerogo/mirror v0.2.4/go.mod h1:pdFnS9P1APNFcULbuT6QaMCuTCa0to4W4rHm6ymkELY= github.com/aerogo/nano v0.3.4 h1:Wk0eRHvsnjni6ROScIo9bRpyuME8ZtgnQwpTi0xbc2M= github.com/aerogo/nano v0.3.4/go.mod h1:OVx7/5zHvieZH4CO5YksGUVOrA+aVGh1TjnqzA73jTQ= +github.com/aerogo/pack v0.6.1 h1:WHkuQGuOaRHMrL+ie/yasVt4Bpd5FXqSCYYCj0eW3Ys= +github.com/aerogo/pack v0.6.1/go.mod h1:B3FfccPZzZhZ3Jf2rTEVE8JbCtJwcABTPcwZR6xHQ2k= github.com/aerogo/packet v0.2.0 h1:YipWaCqHLn73WP+fU85a6yl6GULlUHWyy+ATmcm7pog= github.com/aerogo/packet v0.2.0/go.mod h1:8+cOKIJ35ZJAi8Afd94ed6q8D0eq3KeJFxXUEgTxPY0= +github.com/aerogo/pixy v1.2.8 h1:sEtWdjaWyiVLsj/nh8WmMPjwl6SkwSNI0lH23zljKUk= +github.com/aerogo/pixy v1.2.8/go.mod h1:BddpLok0HvXZqDl5EYHZ85mf392HtA9gPk7IQRuoFnM= +github.com/aerogo/run v1.0.1 h1:IjvFUWo/97srJUIzAkETpj6e/bd9KcweRSQJF8vPJTs= +github.com/aerogo/run v1.0.1/go.mod h1:z4kZn3pRRiOd38DaFcMnLc5kR0coyGUFiIjH4vLCVNI= +github.com/aerogo/run v1.0.2 h1:fcddUcM5ZNjyoAf09mMYlkQzYEfvDvVvbIfR/WGA68k= +github.com/aerogo/run v1.0.2/go.mod h1:cCeDUuD9INS98m2zO8yP0deMC0ozLzYejHjSN7C9dU0= +github.com/aerogo/scarlet v0.3.1 h1:YwaPf20pwkifkGoON2RxbpZeUWcBXh4V+2B8I++Cl7w= +github.com/aerogo/scarlet v0.3.1/go.mod h1:uY+WSUnMPGb6C6CUoXEsoPiigtVl39wieQWusY2Zsvk= github.com/aerogo/session v0.1.4 h1:4OgQyUm3wxSsjNRReZhYdHX8X5lXnFp1W+M3EXr4a3E= github.com/aerogo/session v0.1.4/go.mod h1:aM3FUclBU+wt8kwSs3leTByuaBu0sXrw4P+HwKVkSSw= github.com/aerogo/session v0.1.7 h1:Natc9Pq9KIHDUBR/0YjdazckTdOWBItYmuDplGJJfFc= @@ -69,8 +81,11 @@ github.com/aerogo/sitemap v0.1.3/go.mod h1:/1NT13qIsTm/ydlZHEMd8m014E2yyQkI5coim github.com/akyoto/assert v0.1.3/go.mod h1:g5e6ag+ksCEQENq/LnmU9z04wCAIFDr8KacBusVL0H8= github.com/akyoto/assert v0.2.0 h1:lR7OHrbbBNNZFmRVS8I5MzS0ShLH36ZQVZVyg1bvs6A= github.com/akyoto/assert v0.2.0/go.mod h1:g5e6ag+ksCEQENq/LnmU9z04wCAIFDr8KacBusVL0H8= +github.com/akyoto/autoimport v0.6.4 h1:9VCUjAZUvJIrIZBVkkwcnWUB4gLDBkF5VYNSwcDDino= +github.com/akyoto/autoimport v0.6.4/go.mod h1:4K2kwIeP2rNaR5oUoRUlxgHyukM0j+IfC5P3/ILWeyE= github.com/akyoto/cache v1.0.2 h1:YNaLbfbfBRr21dReBErQxfnVPBsVR/aeFpIKxsF88n8= github.com/akyoto/cache v1.0.2/go.mod h1:MgYroBUaHREY9mmTcavctH4NDzQohCr4WMWPUKv7pq4= +github.com/akyoto/color v1.8.3/go.mod h1:wiwOfYJb0XdHYznfIes7wjr79A/EjGPZ64FfbwJv4RY= github.com/akyoto/color v1.8.4 h1:XS1AL8/JmDHNgN9JRMd1epsQADQF7UXMzUz0nx0kTvY= github.com/akyoto/color v1.8.4/go.mod h1:JXiVjSFNVJjEAneE77ovynlZFYuaDo6yTanD+OHAN/E= github.com/akyoto/color v1.8.5 h1:xvHRmBJdsT5HJxnfyIT8l3zNbexA/2YIIeAlaHuhYGY= @@ -82,6 +97,8 @@ github.com/akyoto/go-matroska v0.1.1/go.mod h1:x+GUVwyby6HN/MKKNP4BvGqP9VrHuEznf github.com/akyoto/hash v0.3.5/go.mod h1:uPmnZyhBJIyLON8V9LNi0CcqtwYaH2RiKLFQg67fwq0= github.com/akyoto/hash v0.4.4 h1:mabc0rYfRdpCZtnn1AI1k2fCPKDG/1GwYQ3yEf0BqqM= github.com/akyoto/hash v0.4.4/go.mod h1:fAgQyV3e4H/PiiOruzVuBXSu78h8lnx567lVQ/y5L4s= +github.com/akyoto/ignore v1.0.4 h1:ONxBnW2TIH3x3kYN94O9x0kYRdHrnNMBAMB2m9XAV9k= +github.com/akyoto/ignore v1.0.4/go.mod h1:7EcPvLQHEzZ53k4nXGKqfEFLwMnUqpaZkt+vbLzW9tE= github.com/akyoto/imageserver v0.3.6 h1:Sxcbgo45Lh7afcSmcU8OS49VYbqh4kE3DK0Lxuuxf74= github.com/akyoto/imageserver v0.3.6/go.mod h1:9AuMUxIt5CPlTmJre4ETwWxRnThOkkE1EhavC8HX4U8= github.com/akyoto/stringutils v0.2.0 h1:86gMW/31LO7zc8mGGWB4gLqyFzrNHMZYyj6ebSQbpH4= @@ -117,6 +134,7 @@ github.com/animenotifier/twist v0.2.6/go.mod h1:sJspetlxvfkge5+Eh0VNKnD7x35Mqtnt github.com/bwmarrin/discordgo v0.19.0 h1:kMED/DB0NR1QhRcalb85w0Cu3Ep2OrGAqZH1R5awQiY= github.com/bwmarrin/discordgo v0.19.0/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8= +github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -135,6 +153,7 @@ github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQD github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/frankban/quicktest v1.4.0 h1:rCSCih1FnSWJEel/eub9wclBSqpF2F/PuvxUWGWnbO8= github.com/frankban/quicktest v1.4.0/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gernest/wow v0.1.0/go.mod h1:dEPabJRi5BneI1Nev1VWo0ZlcTWibHWp43qxKms4elY= github.com/go-chi/chi v4.0.0+incompatible h1:SiLLEDyAkqNnw+T/uDTf3aFB9T4FTrwMpuYrgaRcnW4= github.com/go-chi/chi v4.0.0+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= @@ -196,6 +215,7 @@ github.com/mailgun/mailgun-go/v3 v3.6.0 h1:oQWhyDTFjSiuO6vx1PRlfLZ7Fu+oK0Axn0UTR github.com/mailgun/mailgun-go/v3 v3.6.0/go.mod h1:E81I5Agcfi/u1szdehi6p6ttdRX/UD3Rq2SrUzwyFIU= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs= github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= @@ -230,8 +250,11 @@ github.com/pariz/gountries v0.0.0-20171019111738-adb00f6513a3 h1:lmQNznFSupyfCDE github.com/pariz/gountries v0.0.0-20171019111738-adb00f6513a3/go.mod h1:U0ETmPPEsfd7CpUKNMYi68xIOL8Ww4jPZlaqNngcwqs= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.3.0/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= +github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= github.com/russross/blackfriday v2.0.0+incompatible h1:cBXrhZNUf9C+La9/YpS+UHpUT8YD6Td9ZMSU9APFcsk= github.com/russross/blackfriday v2.0.0+incompatible/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/shirou/gopsutil v2.19.6+incompatible h1:49/Gru26Lne9Cl3IoAVDZVM09hvkSrUodgIIsCVRwbs= @@ -249,6 +272,7 @@ github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2 github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945 h1:N8Bg45zpk/UcpNGnfJt2y/3lRWASHNTUET8owPYCgYI= github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -257,10 +281,16 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/tdewolff/minify/v2 v2.5.1 h1:5Or+sQBV+qUHDQG45lch0iFjUp1wxW0743nLl3qZDrs= +github.com/tdewolff/minify/v2 v2.5.1/go.mod h1:ltNgpU7tnfgNCIHP1D0aS8g9IV0qP7WWP1/HdXIGznE= github.com/tdewolff/parse v2.3.4+incompatible h1:x05/cnGwIMf4ceLuDMBOdQ1qGniMoxpP46ghf0Qzh38= github.com/tdewolff/parse v2.3.4+incompatible/go.mod h1:8oBwCsVmUkgHO8M5iCzSIDtpzXOT0WXX9cWhz+bIzJQ= +github.com/tdewolff/parse/v2 v2.3.8/go.mod h1:HansaqmN4I/U7L6/tUp0NcwT2tFO0F4EAWYGSDzkYNk= +github.com/tdewolff/parse/v2 v2.3.9 h1:d8/K6XOLy5JVpLTG9Kx+SxA72rlm5OowFmVSVgtOlmM= +github.com/tdewolff/parse/v2 v2.3.9/go.mod h1:HansaqmN4I/U7L6/tUp0NcwT2tFO0F4EAWYGSDzkYNk= github.com/tdewolff/test v1.0.0 h1:jOwzqCXr5ePXEPGJaq2ivoR6HOCi+D5TPfpoyg8yvmU= github.com/tdewolff/test v1.0.0/go.mod h1:DiQUlutnqlEvdvhSn2LPGy4TFwRauAaYDsL+683RNX4= +github.com/tdewolff/test v1.0.3/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf h1:Z2X3Os7oRzpdJ75iPqWZc0HeJWFYNCvKsfpQwFpRNTA= github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0= github.com/ungerik/go-gravatar v0.0.0-20120802094239-6ab22628222a h1:TZyMbJbyPL+4/ndyXns8aNDrmUJn5a6aV8lj3qEM7fM= @@ -326,6 +356,8 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181031143558-9b800f95dbbc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190116161447-11f53e031339/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= @@ -333,6 +365,7 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190428183149-804c0c7841b5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug= @@ -350,6 +383,8 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190825160603-fb81701db80f h1:LCxigP8q3fPRGNVYndYsyHnF0zRrvcoVwZMfb8iQZe4= golang.org/x/sys v0.0.0-20190825160603-fb81701db80f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= diff --git a/makefile b/makefile index a6a1e6eb..7bdbb5de 100644 --- a/makefile +++ b/makefile @@ -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 - diff --git a/tools/tools.go b/tools/tools.go new file mode 100644 index 00000000..d4914a94 --- /dev/null +++ b/tools/tools.go @@ -0,0 +1,9 @@ +package tools + +import ( + // pack to generate our assets + _ "github.com/aerogo/pack" + + // run as a development server that restarts on changes + _ "github.com/aerogo/run" +)