forked from PrefectHQ/marvin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserve_legacy_docs
executable file
·69 lines (56 loc) · 1.5 KB
/
serve_legacy_docs
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
#!/bin/bash
# Setup a temporary directory for cloning
temp_dir=$(mktemp -d)
echo "Using temporary directory: $temp_dir"
cleanup() {
echo "Cleaning up..."
if [[ "$VIRTUAL_ENV" != "" ]]; then
deactivate
fi
rm -rf "$temp_dir"
trap - INT EXIT
exit
}
trap cleanup INT EXIT
command_exists() {
type "$1" &> /dev/null ;
}
# Determine the Python command to use
PYTHON_CMD=""
if command_exists python3; then
PYTHON_CMD="python3"
elif command_exists python && [[ $(python --version 2>&1) == Python\ 3* ]]; then
PYTHON_CMD="python"
fi
if [[ -z $PYTHON_CMD ]]; then
echo "Python 3 is not installed."
exit 1
fi
if command_exists git && command_exists pip; then
echo "All necessary tools are installed."
else
echo "Please ensure Git and pip are installed."
exit 1
fi
REPO_URL="https://github.com/PrefectHQ/marvin.git"
TAG="${1:-v1.5.6}"
if [[ "$OSTYPE" == "darwin"* ]]; then
export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib
fi
# Clone the repository into the temporary directory
git clone "$REPO_URL" "$temp_dir/marvin"
cd "$temp_dir/marvin"
# Check if the tag exists
if git rev-parse "tags/$TAG" >/dev/null 2>&1; then
git checkout "tags/$TAG"
else
echo "Error: Tag '$TAG' not found in the repository."
exit 1
fi
# Create and activate a temporary virtual environment
$PYTHON_CMD -m venv temp_env
source temp_env/bin/activate
pip install "mkdocs-material[imaging]"
pip install -e ".[dev,docs]"
open http://localhost:8000
mkdocs serve -a localhost:8000