mdittmer / web-apis

Playground for better understanding Web APIs
Apache License 2.0
18 stars 10 forks source link

Setup instructions assumes zsh and GNU tools? #41

Open foolip opened 7 years ago

foolip commented 7 years ago

https://github.com/mdittmer/web-apis#serving-locally-for-development

. ./scripts/dev_env.sh results in the following errors on a Mac running bash:

dirname: illegal option -- b
usage: dirname path
readlink: illegal option -- f
usage: readlink [-n] [file ...]

The BSD readline doesn't have the -f option. And there's something different about what $0 means I guess.

foolip commented 6 years ago

Ran into this again today on my Mac. Here are the changes I did to make it work:

diff --git a/scripts/dev_env.sh b/scripts/dev_env.sh
index 67d519d..1fdd782 100755
--- a/scripts/dev_env.sh
+++ b/scripts/dev_env.sh
@@ -2,7 +2,7 @@

 # Source this file to setup development environment

-WD=$(readlink -f $(dirname "$0"))
+WD=$(dirname "$0")

 NODE_PATH=$WD/..
 NODEJS_BIN=$WD/../node_modules/.bin
diff --git a/scripts/serve.sh b/scripts/serve.sh
index 214d82a..ae8898f 100644
--- a/scripts/serve.sh
+++ b/scripts/serve.sh
@@ -1,6 +1,6 @@
 #!/bin/zsh

-export SH_DIR=$(readlink -f $(dirname "$0"))
+export SH_DIR=$(dirname "$0")

 GRAY='\033[0;47m'
 GREEN='\033[0;32m'

And then . ./scripts/dev_env.sh has to be run in zsh.

foolip commented 6 years ago

Had trouble on Debian as well, but installing zsh is all that's needed.

mdittmer commented 6 years ago

@lukebjerring didn't we recently build a solution to the need for absolute URLs without readlink -f?

foolip commented 5 years ago

@mdittmer this is an issue I need to work around every time I collect data on macOS, and when I tried collecting using BrowerStack last week.

mdittmer commented 5 years ago

bandaid