diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..ad2abb2 --- /dev/null +++ b/.envrc @@ -0,0 +1,13 @@ +export VIRTUAL_ENV=."venv" +if [ ! -d "$VIRTUAL_ENV" ]; then + echo -n "Creating virtual environment..." + python -m venv "$VIRTUAL_ENV" + echo "done." + echo -n "Activating virtual environment..." + layout python3 + echo "done." +else + echo -n "Activating virtual environment..." + layout python3 + echo "done." +fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22c708e..099c99d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,13 +5,18 @@ This site is built wtih [MkDocs](https://www.mkdocs.org). Pull requests are welc ## Install requirements ```sh -pip install -r requirements.txt +script/bootstrap +``` + +### If you have direnv installed: +```sh +direnv allow ``` ## Edit interactively ```sh -mkdocs serve +mkdocs serve -w docs/ ``` changes made in `docs/` will be reflected in the browser session. diff --git a/docs/config.md b/docs/config.md index a87944a..2f2f35a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -25,6 +25,7 @@ These settings are intended to facilitate a stable and reliable mesh network. Th ### LoRa **LongFast Config** + | Option | Recommended Config | Notes | | -------------: | :----------------- | :----------------------------------------------------------------------------------------------- | | Modem Preset | LONG_FAST | This is the default. | @@ -34,6 +35,7 @@ These settings are intended to facilitate a stable and reliable mesh network. Th | OK to MQTT | `True` | Added in `2.5.0`. Enable to show up on online tools like [info.MtnMe.sh](https://info.mtnme.sh). | **MediumFast Config** + | Option | Recommended Config | Notes | | -------------: | :----------------- | :----------------------------------------------------------------------------------------------- | | Modem Preset | MEDIUM_FAST | This is the new fast network | diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 0000000..16a6189 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,51 @@ +#!/bin/bash + +# accept input string and print it in green +function GRN() { + if [[ $1 == "-n" ]]; then + echo -n -e "\033[0;32m$2\033[0m" + else + echo -e "\033[0;32m$1\033[0m" + fi +} + +# accept input string and print it in red +function RED() { + if [[ $1 == "-n" ]]; then + echo -n -e "\033[0;31m$2\033[0m" + else + echo -e "\033[0;31m$1\033[0m" + fi +} + +# accept input string and print it in yellow +function YLW() { + if [[ $1 == "-n" ]]; then + echo -n -e "\033[0;33m$2\033[0m" + else + echo -e "\033[0;33m$1\033[0m" + fi +} + +YLW -n "Creating virtual environment... " +if [[ ! -d .venv ]]; then + python3 -m venv .venv || { + RED "failed" + exit 1 + } +fi +GRN "done" + +YLW -n "Activating virtual environment..." +source .venv/bin/activate || { + RED "failed" + exit 1 +} +GRN "done" + +YLW -n "Installing dependencies..." +pip install -r requirements.txt || { + RED "failed" + exit 1 +} +GRN "done"