-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·47 lines (41 loc) · 1.25 KB
/
install.sh
File metadata and controls
executable file
·47 lines (41 loc) · 1.25 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
#!/usr/bin/env sh
# scafld installer
#
# One-liner:
# curl -fsSL https://raw.githubusercontent.com/nilstate/scafld/main/install.sh | sh
#
# Or after cloning:
# git clone https://github.com/nilstate/scafld.git ~/.scafld
# ~/.scafld/install.sh
set -e
SCAFLD_HOME="${SCAFLD_HOME:-$HOME/.scafld}"
BIN_DIR="${BIN_DIR:-$HOME/.local/bin}"
echo "Installing scafld..."
# Clone or update
if [ -d "$SCAFLD_HOME/.git" ]; then
echo " Updating $SCAFLD_HOME"
git -C "$SCAFLD_HOME" pull --quiet
else
# If running from curl, clone fresh. If running from existing clone, skip.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ "$SCRIPT_DIR" = "$SCAFLD_HOME" ]; then
echo " Using $SCAFLD_HOME"
else
echo " Cloning to $SCAFLD_HOME"
git clone --quiet -b main https://github.com/nilstate/scafld.git "$SCAFLD_HOME"
fi
fi
# Symlink CLI
mkdir -p "$BIN_DIR"
ln -sf "$SCAFLD_HOME/cli/scafld" "$BIN_DIR/scafld"
chmod +x "$SCAFLD_HOME/cli/scafld"
echo " Linked scafld -> $BIN_DIR/scafld"
# Check PATH
case ":$PATH:" in
*":$BIN_DIR:"*) ;;
*) echo ""
echo " Add $BIN_DIR to your PATH:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" ;;
esac
echo ""
echo "Done! Run 'scafld init' in any project to get started."