-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·40 lines (34 loc) · 1.17 KB
/
install.sh
File metadata and controls
executable file
·40 lines (34 loc) · 1.17 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
#!/usr/bin/env bash
# Install gittrace globally so you can run it from anywhere
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_DIR="${GITTRACE_INSTALL_DIR:-$HOME/.local/opt/gittrace}"
BIN_DIR="${GITTRACE_BIN_DIR:-$HOME/.local/bin}"
# Load asdf if available (for build)
if [[ -f "$HOME/.asdf/asdf.sh" ]]; then
source "$HOME/.asdf/asdf.sh"
elif [[ -f "/opt/homebrew/opt/asdf/libexec/asdf.sh" ]]; then
source "/opt/homebrew/opt/asdf/libexec/asdf.sh"
fi
echo "Building gittrace..."
cd "$SCRIPT_DIR"
./gradlew installDist --no-daemon -q
echo "Installing to $INSTALL_DIR..."
mkdir -p "$(dirname "$INSTALL_DIR")"
rm -rf "$INSTALL_DIR"
cp -R build/install/gittrace "$INSTALL_DIR"
mkdir -p "$BIN_DIR"
ln -sf "$INSTALL_DIR/bin/gittrace" "$BIN_DIR/gittrace"
echo ""
echo "Done! gittrace is installed."
echo ""
if [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
echo "Add this to your shell config (~/.zshrc or ~/.bashrc) to use from anywhere:"
echo ""
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
echo "Then run: source ~/.zshrc # or source ~/.bashrc"
echo ""
else
echo "Run 'gittrace' from any directory (e.g. gittrace -fl=\"src/Main.kt:20\")"
fi