-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
56 lines (46 loc) · 1.6 KB
/
bootstrap.sh
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
#!/usr/bin/env bash
# Source this script to bootstrap dotfiles installation requirements.
if [ -z "$DOTFILES" ]; then
echo '$DOTFILES must be set to the root directory of the dotfiles to bootstrap.'
exit 1
fi
# Install asdf if needed and use it to set up python.
if [ ! -f ~/.asdf/asdf.sh ]; then
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0
fi
source ~/.asdf/asdf.sh
# asdf saves the current python version in the .tool-versions file and picks it
# up when sourced. Create that file if it is not there already.
if [ ! -f "$DOTFILES/.tool-versions" ]; then
if ! asdf plugin list | grep -q python; then
asdf plugin add python
fi
asdf install python latest > /dev/null
cd "$DOTFILES"
asdf local python latest
cd -
fi
# Create venv if necessary and load it.
if [ ! -d "$DOTFILES/.venv" ] ; then
python -m venv "$DOTFILES"/.venv
source "$DOTFILES"/.venv/bin/activate
python -m pip install -r "$DOTFILES"/requirements.txt
else
source "$DOTFILES"/.venv/bin/activate
fi
# Set default options for robot.
ROBOT_OPTIONS="
--outputdir="$DOTFILES/.logs"
--variable=INSTALLER:"$DOTFILES/installer.sh"
--variable=MODE:skip
"
# Use short options for uname, since gnu coreutils may not be installed on a fresh mac setup.
kernel="$(uname -s)"
if [ "$kernel" = 'Linux' ]; then
ROBOT_OPTIONS="$ROBOT_OPTIONS --include=linux"
elif [ "$kernel" = 'Darwin' ]; then
ROBOT_OPTIONS="$ROBOT_OPTIONS --include=macos"
fi
# Only run setup.robot files, not robot files with any other name.
ROBOT_OPTIONS="$ROBOT_OPTIONS --suite=setup"
export ROBOT_OPTIONS