-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
Β·211 lines (180 loc) Β· 4.64 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
Β·211 lines (180 loc) Β· 4.64 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/bin/bash
# Integral Philosophy Publishing System - Elegant Setup Script
# Sets up a beautiful, clean environment for academic content processing
set -e # Exit on any error
# Colors for beautiful output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Emoji for beautiful output
ROCKET="π"
SPARKLE="β¨"
GEAR="βοΈ"
CHECK="β
"
BOOK="π"
WRENCH="π οΈ"
# Print with style
print_style() {
echo -e "${2}${1}${NC}"
}
print_header() {
echo
print_style "π Integral Philosophy Publishing System π" "$CYAN"
print_style "Elegant Academic Content Processing Pipeline" "$BLUE"
echo
}
print_step() {
echo
print_style "$1 $2" "$3"
}
print_success() {
print_style "$CHECK $1" "$GREEN"
}
print_error() {
print_style "β $1" "$RED"
}
# Check prerequisites
check_prerequisites() {
print_step "$GEAR" "Checking prerequisites..." "$YELLOW"
# Check Python
if command -v python3 &>/dev/null; then
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
print_success "Python $PYTHON_VERSION found"
else
print_error "Python 3.8+ is required but not found"
exit 1
fi
# Check pip
if command -v pip3 &>/dev/null; then
print_success "pip found"
else
print_error "pip is required but not found"
exit 1
fi
# Check Pandoc (optional but recommended)
if command -v pandoc &>/dev/null; then
PANDOC_VERSION=$(pandoc --version | head -n1 | cut -d' ' -f2)
print_success "Pandoc $PANDOC_VERSION found"
else
print_style "β οΈ Pandoc not found (optional but recommended for full functionality)" "$YELLOW"
fi
}
# Create virtual environment
create_venv() {
print_step "$GEAR" "Creating beautiful virtual environment..." "$BLUE"
if [ ! -d "venv" ]; then
python3 -m venv venv
print_success "Virtual environment created"
else
print_success "Virtual environment already exists"
fi
}
# Activate virtual environment
activate_venv() {
print_step "$GEAR" "Activating virtual environment..." "$BLUE"
if [ -f "venv/bin/activate" ]; then
source venv/bin/activate
print_success "Virtual environment activated"
else
print_error "Virtual environment not found"
exit 1
fi
}
# Install dependencies
install_dependencies() {
print_step "$GEAR" "Installing elegant dependencies..." "$BLUE"
# Upgrade pip
pip install --upgrade pip >/dev/null 2>&1
# Install core dependencies
if [ -f "docs/user/requirements.txt" ]; then
pip install -r docs/user/requirements.txt
print_success "Core dependencies installed"
else
# Install essential packages manually
pip install beautifulsoup4 lxml selenium requests pandas numpy matplotlib seaborn plotly networkx pillow jinja2 flask pyyaml >/dev/null 2>&1
print_success "Essential dependencies installed"
fi
}
# Create necessary directories
create_directories() {
print_step "$GEAR" "Creating beautiful directory structure..." "$BLUE"
mkdir -p data/{input,output,cache}
mkdir -p logs
mkdir -p temp
print_success "Directory structure created"
}
# Setup configuration
setup_config() {
print_step "$GEAR" "Setting up beautiful configuration..." "$BLUE"
if [ ! -f "config/pipelines/default.yaml" ]; then
print_success "Configuration already exists"
else
print_success "Default configuration ready"
fi
}
# Validate installation
validate_installation() {
print_step "$GEAR" "Validating beautiful installation..." "$YELLOW"
# Test Python imports
python3 -c "
import sys
sys.path.insert(0, 'core')
try:
import yaml
import requests
from bs4 import BeautifulSoup
print('β
Core modules import successfully')
except ImportError as e:
print(f'β Import error: {e}')
exit(1)
"
if [ $? -eq 0 ]; then
print_success "Installation validated"
else
print_error "Installation validation failed"
exit 1
fi
}
# Show next steps
show_next_steps() {
echo
print_style "$SPARKLE Beautiful Setup Complete! $SPARKLE" "$GREEN"
echo
print_style "$BOOK Quick Start Guide:" "$CYAN"
echo
echo " 1. Activate environment:"
echo " $ source venv/bin/activate"
echo
echo " 2. Process content:"
echo " $ python main.py process https://example.com --output ./results"
echo
echo " 3. Start web interface:"
echo " $ python main.py web --port 8000"
echo
echo " 4. Start API server:"
echo " $ python main.py api --port 8001"
echo
echo " 5. Get help:"
echo " $ python main.py --help"
echo
print_style "$ROCKET Your elegant academic publishing system is ready!" "$GREEN"
echo
}
# Main setup function
main() {
print_header
check_prerequisites
create_venv
activate_venv
install_dependencies
create_directories
setup_config
validate_installation
show_next_steps
}
# Run the beautiful setup
main "$@"