-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·83 lines (70 loc) · 1.42 KB
/
run
File metadata and controls
executable file
·83 lines (70 loc) · 1.42 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
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env bash
script_dir=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
filter=""
dry="0"
while [[ $# > 0 ]]; do
if [[ $1 == "--dry" ]]; then
dry="1"
else
filter="$1"
fi
shift
done
log(){
if [[ $dry == "1" ]]; then
echo "[DRY_RUN]: $@"
else
echo "$@"
fi
}
execute(){
log "execute $@"
if [[ $dry == "1" ]]; then
return
fi
"$@"
}
log "$script_dir -- $filter"
cd $script_dir
# Install Homebrew
if [ ! -d "/opt/homebrew/" ]; then
log "Installing Homebrew"
if [[ $dry != "1" ]]; then
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
else
log "Homebrew is already installed"
fi
if [ ! -f "/opt/homebrew/bin/gfind" ]; then
log "Installing findutils"
if [[ $dry != "1" ]]; then
brew install findutils
fi
else
log "findutils is already installed"
fi
if ! command -v rg >/dev/null 2>&1; then
log "Installing ripgrep"
if [[ $dry != "1" ]]; then
brew install ripgrep
fi
else
log "ripgrep is already installed"
fi
if [ ! -d "${HOME}/workspace" ]; then
log "creating workspace directory..."
if [[ $dry != "1" ]]; then
mkdir workspace
fi
else
log "workspace directory already exists"
fi
scripts=$(gfind ./runs -maxdepth 1 -mindepth 1 -executable -type f)
for script in $scripts; do
if echo "$script" | grep -qv "$filter"; then
log "filtering $script"
continue
fi
execute ./$script
done