ember-learn / ember-jsonapi-docs

fixes up the ember docs generated by YUIDoc to be in JSONAPI format + some other niceties
9 stars 11 forks source link

Cross-platform script. Linux & macOS #54

Closed williamhaley closed 6 years ago

williamhaley commented 6 years ago

Update generate-local.sh to work on both macOS and Linux. It seems cp -r behaves differently on Linux and macOS (verified on Arch and Ubuntu).

When running generate-locale.sh it ends up calling something along the lines of cp -rv ../src/2.18.1/ ../dst/2.18.1/ and creates ../dst/2.18.1/2.18.1 in ember-api-docs on Linux.

That behavior seems weird to me, and does not exist on Darwin/macOS. Seems to only happen with GNU cp.

# Bad behavior on Linux
$ rm -rf /tmp/{a,b}; mkdir -p /tmp/{a,b}/1; touch /tmp/a/1/test.txt; cp -rv /tmp/a/1/ /tmp/b/1/
'/tmp/a/1/' -> '/tmp/b/1/1'
'/tmp/a/1/test.txt' -> '/tmp/b/1/1/test.txt'

This can be fixed by using * to copy from the src.

# Workaround
$ rm -rf /tmp/{a,b}; mkdir -p /tmp/{a,b}/1; touch /tmp/a/1/test.txt; cp -rv /tmp/a/1/* /tmp/b/1/
'/tmp/a/1/test.txt' -> '/tmp/b/1/test.txt'

I tested the updates on macOS (latest) and Arch and everything seems ok in my testing.

williamhaley commented 6 years ago

Thanks @locks! And thanks @toddjordan for helping me to get this working properly with my local environment.