-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.envrc
More file actions
71 lines (58 loc) · 2.27 KB
/
Copy path.envrc
File metadata and controls
71 lines (58 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
# This file is used by `direnv` to install all Python and Node dependencies
# specified in the Makefile into the virtual env located in the `.gotmp/env` directory.
# Steps to set up:
# 1. Install direnv: https://direnv.net/docs/installation.html
# 2. Hook direnv into your shell: https://direnv.net/docs/hook.html
# 3. Create the global config: https://github.com/direnv/direnv/blob/master/man/direnv.toml.1.md
# where `~/workspace/ddev/.envrc` is the path to this file.
# (Alternatively, `.envrc` file can be loaded with `direnv allow .`)
# $ cat ~/.config/direnv/direnv.toml
# [global]
# hide_env_diff = true
# [whitelist]
# exact = ["~/workspace/ddev/.envrc"]
# 4. After setting this up, when you `cd` into this directory, all required tools
# will automatically be installed in `.gotmp/env` and sourced.
# 5. To update tools, run `make clean`, then `cd` out of and back into this directory.
PYTHON_ENV=.gotmp/env/python
NODE_ENV=.gotmp/env/node
if ! command -v python >/dev/null 2>&1 && ! command -v python3 >/dev/null 2>&1; then
echo "Python is not available."
exit 1
fi
if [[ ! -f "${PYTHON_ENV}/bin/activate" ]]; then
echo "Initializing python venv..."
python -m venv "${PYTHON_ENV}" || python3 -m venv "${PYTHON_ENV}"
fi
source "${PYTHON_ENV}/bin/activate"
if [[ ! -f "${NODE_ENV}/bin/activate" ]]; then
echo "Initializing python nodeenv..."
pip install nodeenv
nodeenv --node=lts --prebuilt "${NODE_ENV}"
fi
source "${NODE_ENV}/bin/activate"
if [[ ! -f "${PYTHON_ENV}/bin/mkdocs" ]]; then
echo "Installing mkdocs..."
pip install -r docs/mkdocs-pip-requirements
fi
if [[ ! -f "${PYTHON_ENV}/bin/pyspelling" ]]; then
echo "Installing pyspelling..."
pip install pyspelling pymdown-extensions
fi
if [[ ! -f "${NODE_ENV}/bin/markdownlint" ]]; then
echo "Installing markdownlint..."
npm install -g markdownlint-cli
fi
if [[ ! -f "${NODE_ENV}/bin/linkspector" ]]; then
echo "Installing linkspector..."
npm install -g @umbrelladocs/linkspector
fi
if [[ ! -f "${NODE_ENV}/bin/textlint" ]]; then
echo "Installing textlint..."
npm install -g textlint \
textlint-filter-rule-comments \
textlint-rule-no-todo \
textlint-rule-stop-words \
textlint-rule-terminology
fi