Skip to content

Commit 08ecc3a

Browse files
committed
Add some scripts
See RFC https://github.com/PostHog/meta/pull/309/files for some context on these scripts.
1 parent c1b3c01 commit 08ecc3a

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ Posthog.feature_flags("user_123",
137137

138138
## Local Development
139139

140+
Run `bin/setup` to install development dependencies or run the following commands manually:
141+
140142
We recommend using `asdf` to manage Elixir and Erlang versions:
141143

142144
```sh
@@ -148,6 +150,14 @@ mix deps.get
148150
mix compile
149151
```
150152

153+
Run tests:
154+
155+
```sh
156+
bin/test
157+
```
158+
159+
(This runs `mix test`).
160+
151161
### Troubleshooting
152162

153163
If you encounter WX library issues during Erlang installation:

bin/helpers/_utils.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error() {
2+
echo "$@" >&2
3+
}
4+
5+
fatal() {
6+
error "$@"
7+
exit 1
8+
}
9+
10+
set_source_and_root_dir() {
11+
{ set +x; } 2>/dev/null
12+
source_dir="$( cd -P "$( dirname "$0" )" >/dev/null 2>&1 && pwd )"
13+
root_dir=$(cd $source_dir && cd ../ && pwd)
14+
cd $root_dir
15+
}

bin/setup

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
#/ Usage: bin/test [<configuration>]
3+
#/ Description: Runs all the tests for the target frameworks: netstandard2.1 and net8.0
4+
source bin/helpers/_utils.sh
5+
set_source_and_root_dir
6+
7+
if ! command -v asdf &> /dev/null; then
8+
brew install asdf
9+
fi
10+
11+
asdf plugin add erlang
12+
asdf plugin add elixir
13+
asdf install
14+
15+
mix deps.get
16+
mix compile

bin/test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
#/ Usage: bin/test [<configuration>]
3+
#/ Description: Runs all the tests for the target frameworks: netstandard2.1 and net8.0
4+
source bin/helpers/_utils.sh
5+
set_source_and_root_dir
6+
7+
mix test

0 commit comments

Comments
 (0)