77 lines
2.5 KiB
Bash
Executable File
77 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Integrated CRM Application Build Script
|
|
|
|
set -e
|
|
|
|
echo "Building Integrated CRM Application..."
|
|
|
|
# Get the current directory
|
|
APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# Function to build a module if it exists
|
|
build_module() {
|
|
local module_name=$1
|
|
local module_path="$HOME/repos/$module_name"
|
|
|
|
if [ -d "$module_path" ]; then
|
|
echo "Processing module: $module_name"
|
|
|
|
# Process database models if they exist
|
|
if [ -d "$module_path/models" ]; then
|
|
echo " Processing database models..."
|
|
cd "$module_path/models"
|
|
|
|
# Check for JSON files (preferred)
|
|
if ls *.json >/dev/null 2>&1; then
|
|
json2ddl mysql . > "$module_path/mysql.ddl.sql" 2>/dev/null || true
|
|
fi
|
|
|
|
# Check for XLSX files as fallback
|
|
if ls *.xlsx >/dev/null 2>&1; then
|
|
xls2ddl mysql . > "$module_path/mysql.ddl.sql" 2>/dev/null || true
|
|
fi
|
|
fi
|
|
|
|
# Process CRUD definitions if they exist
|
|
if [ -d "$module_path/json" ]; then
|
|
echo " Processing CRUD definitions..."
|
|
cd "$module_path"
|
|
if ls json/*.json >/dev/null 2>&1; then
|
|
xls2ui -m ./models -o ./wwwroot "$module_name" json/*.json 2>/dev/null || true
|
|
fi
|
|
fi
|
|
|
|
# Create symbolic links for wwwroot if it exists
|
|
if [ -d "$module_path/wwwroot" ]; then
|
|
echo " Creating wwwroot symlinks..."
|
|
cd "$APP_DIR"
|
|
mkdir -p wwwroot/modules
|
|
ln -sf "$module_path/wwwroot" "wwwroot/modules/$module_name" 2>/dev/null || true
|
|
fi
|
|
else
|
|
echo "Warning: Module $module_name not found at $module_path"
|
|
fi
|
|
}
|
|
|
|
# Build all required modules
|
|
build_module "appbase"
|
|
build_module "rbac"
|
|
build_module "customer_management"
|
|
build_module "opportunity_management"
|
|
build_module "contract_management"
|
|
build_module "financial_management"
|
|
|
|
# Create main application wwwroot links
|
|
echo "Creating main application links..."
|
|
cd "$APP_DIR"
|
|
mkdir -p wwwroot/main
|
|
ln -sf "$APP_DIR/wwwroot/base.ui" wwwroot/main/base.ui
|
|
ln -sf "$APP_DIR/wwwroot/login.ui" wwwroot/main/login.ui
|
|
ln -sf "$APP_DIR/wwwroot/login.dspy" wwwroot/main/login.dspy
|
|
|
|
echo "Build completed successfully!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Run the DDL scripts to create database tables"
|
|
echo "2. Start the AhServer application"
|
|
echo "3. Access the application at /main/base.ui" |