Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iss #5: macos dev support #6

Merged
merged 3 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 85 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ All kudos go to original

Branch | Description
------ | -----------
[setup-fork](https://github.com/maizy/sightreading.training/tree/setup-fork) | Fork setup, fix file names for macOS
[iss4-serverless-build](https://github.com/maizy/sightreading.training/tree/iss4-serverless-build) | Serverless version: build docker container
[setup-fork](https://github.com/maizy/sightreading.training/pull/2/files) | Fork setup, fix file names for macOS
[iss4-serverless-build](https://github.com/maizy/sightreading.training/pull/7/files) | Serverless version: build docker container
[iss5-macos-dev-support](https://github.com/maizy/sightreading.training/pull/6/files) | Dev automation for serverless version, especially for macOS

## Serverless version

Expand All @@ -27,3 +28,85 @@ docker run -p 8080:80 st-serverless:latest
```

Server started at [http://127.0.0.1:8080/](http://127.0.0.1:8080/)

## Dev env on macOS

#### 1\.

```
brew cask install osxfuse
brew install sassc npm tup
```

#### 2\. comment line with moon

in `Tuprules.tup`

```diff
--- a/Tuprules.tup
+++ b/Tuprules.tup
@@ -15,4 +15,4 @@ TOP = $(TUP_CWD)
!pegjs = |> cat %f | $(TOP)/node_modules/.bin/pegjs --format amd | sed -e 's/^define(/define("st\/%O", /' > %o |>

: foreach *.scss |> !scss |> %B.css
-: foreach *.moon |> moonc %f |> %B.lua
+# : foreach *.moon |> moonc %f |> %B.lua
```

and in `static/guides/Tupfile`

```diff
--- a/static/guides/Tupfile
+++ b/static/guides/Tupfile
@@ -1,3 +1,3 @@
.gitignore

-: foreach *.md |> moon convert_to_json.moon %f > %o |> %B.json
+#: foreach *.md |> moon convert_to_json.moon %f > %o |> %B.json
```


#### 3\. init tup DB

```
tup init
```

#### 4\. update generated files

```
tup
```

#### Extra: reinit tup generated files

```
rm -rf .tup/
./cleanup.sh
```

Then do 3rd & 4th steps again.

## Run dev serverless version

#### 1\. Install docker-compose

#### 2\. Build all static

For macOS see instruction above.

#### 3\. Run

```
docker-compose -f dev-docker-compose.yml up
```

#### 4\. After any changes

Run tup for regenerating files

```
tup
```

or use `tup monitor` if you on linux.
14 changes: 14 additions & 0 deletions cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -o xtrace

ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

cd "$ROOT_DIR"

rm static/js/song_parser_peg.es6 2>/dev/null
find static -name '*.css' -exec rm {} \;
find static -name '*.js' \
-not -path static/define_libs.js \
-not -path 'static/soundfonts/*' \
-not -path static/pre_libs.js \
-exec rm {} \;
23 changes: 23 additions & 0 deletions dev-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3.7'
services:
nginx:
image: nginx:1.17.6-alpine
ports:
- "${LISTENIP:-127.0.0.1}:8080:80"
volumes:
- type: bind
source: ./static
target: /site/sightreading.training/static
- type: bind
source: ./serverless
target: /site/sightreading.training/serverless
- type: bind
source: ./mime.types
target: /site/sightreading.training/mime.types
- type: bind
source: ./serverless-nginx.conf
target: /site/sightreading.training/serverless-nginx.conf
entrypoint:
- nginx
- '-c'
- /site/sightreading.training/serverless-nginx.conf