-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·64 lines (54 loc) · 1.72 KB
/
build.sh
File metadata and controls
executable file
·64 lines (54 loc) · 1.72 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
#!/bin/bash
# Exit on error
set -e
# Function to get the user's shell config file
get_shell_config() {
# Detect the current shell
CURRENT_SHELL=$(basename "$SHELL")
case "$CURRENT_SHELL" in
"bash")
if [ "$(uname)" == "Darwin" ]; then
echo "$HOME/.bash_profile"
else
echo "$HOME/.bashrc"
fi
;;
"zsh")
echo "$HOME/.zshrc"
;;
*)
echo "$HOME/.profile"
;;
esac
}
# Create and activate a virtual environment
echo "Creating virtual environment..."
python3 -m venv .venv
# Activate virtual environment (works in both Unix and Windows/Git Bash)
if [ "$(uname)" == "Darwin" ] || [ "$(uname)" == "Linux" ]; then
source .venv/bin/activate
else
source .venv/Scripts/activate
fi
# Install the package in editable mode
echo "Installing package..."
pip install -e . --no-cache-dir --force-reinstall
# Get the absolute path to the virtual environment's bin/Scripts directory
if [ "$(uname)" == "Darwin" ] || [ "$(uname)" == "Linux" ]; then
VENV_BIN="$(pwd)/.venv/bin"
else
VENV_BIN="$(pwd)/.venv/Scripts"
fi
# Get the appropriate shell config file
SHELL_CONFIG=$(get_shell_config)
# Check if PATH already includes our bin directory
if ! grep -q "$VENV_BIN" "$SHELL_CONFIG" 2>/dev/null; then
echo "Adding schema2code to PATH..."
echo "export PATH=\"$VENV_BIN:\$PATH\"" >> "$SHELL_CONFIG"
echo "Please run 'source $SHELL_CONFIG' to update your PATH, or restart your terminal"
else
echo "schema2code is already in PATH"
fi
echo "Installation complete!"
echo "You can now use 'schema2code' from anywhere in your terminal"
echo "Run 'schema2code --help' to see available options"