Files
markitect-main/install.sh
tegwick 8e6ba272ca feat: implement markitect installer with version/release commands (issue #80)
- Add comprehensive version information system with git integration
- Add `markitect version` and `markitect release` commands with multiple output formats
- Add global `--version` flag for quick version checking
- Create Python installer script with advanced options (install.py)
- Create shell installer wrapper for easy installation (install.sh)
- Add comprehensive installation documentation (INSTALL.md)
- Support user and system-wide installations with virtual environments
- Include development mode installation with test dependencies
- Add installation status checking and uninstall functionality

Commands added:
- `markitect --version` - Quick version display
- `markitect version [--short]` - Detailed version information
- `markitect release [--format text|json|yaml]` - Release information

Installer features:
- Automatic virtual environment creation
- Symbolic link management for global access
- Custom installation paths and prefixes
- Development mode with test dependencies
- Installation validation and troubleshooting

Resolves #80

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 05:47:02 +02:00

160 lines
3.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
#
# MarkiTect Quick Installer
#
# This script provides a simple way to install MarkiTect.
# It's a wrapper around the Python installer script.
#
# Usage:
# ./install.sh [options]
# curl -sSL https://raw.githubusercontent.com/example/markitect/main/install.sh | bash
#
# Options:
# --system Install system-wide (requires sudo)
# --dev Install in development mode
# --check Check installation status
# --uninstall Uninstall MarkiTect
# --help Show help
set -e
# Default options
SYSTEM=""
DEV=""
CHECK=""
UNINSTALL=""
HELP=""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_info() {
echo -e "${BLUE} $1${NC}"
}
print_success() {
echo -e "${GREEN}$1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}$1${NC}"
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--system)
SYSTEM="--system"
shift
;;
--dev)
DEV="--dev"
shift
;;
--check)
CHECK="--check"
shift
;;
--uninstall)
UNINSTALL="--uninstall"
shift
;;
--help|-h)
HELP="--help"
shift
;;
*)
print_error "Unknown option: $1"
exit 1
;;
esac
done
# Show help if requested
if [[ -n "$HELP" ]]; then
cat << EOF
MarkiTect Quick Installer
Usage: $0 [options]
Options:
--system Install system-wide (requires sudo)
--dev Install in development mode with test dependencies
--check Check current installation status
--uninstall Uninstall MarkiTect
--help Show this help message
Examples:
$0 # Install for current user
$0 --system # Install system-wide
$0 --dev # Install in development mode
$0 --check # Check installation status
$0 --uninstall # Uninstall MarkiTect
For more advanced options, use the Python installer directly:
python install.py --help
EOF
exit 0
fi
# Check if Python is available
if ! command -v python3 &> /dev/null; then
print_error "Python 3 is required but not found"
print_info "Please install Python 3.8 or higher and try again"
exit 1
fi
# Check Python version
python_version=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
required_version="3.8"
if ! python3 -c "import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1)"; then
print_error "Python $required_version or higher is required (found: $python_version)"
exit 1
fi
print_success "Python $python_version found"
# Determine script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALLER_SCRIPT="$SCRIPT_DIR/install.py"
# Check if installer script exists
if [[ ! -f "$INSTALLER_SCRIPT" ]]; then
print_error "Installer script not found: $INSTALLER_SCRIPT"
print_info "Make sure you're running this from the MarkiTect project directory"
exit 1
fi
# Build command
cmd="python3 $INSTALLER_SCRIPT"
if [[ -n "$SYSTEM" ]]; then
cmd="$cmd $SYSTEM"
print_warning "System installation requires sudo privileges"
fi
if [[ -n "$DEV" ]]; then
cmd="$cmd $DEV"
fi
if [[ -n "$CHECK" ]]; then
cmd="$cmd $CHECK"
fi
if [[ -n "$UNINSTALL" ]]; then
cmd="$cmd $UNINSTALL"
fi
# Run the installer
print_info "Running: $cmd"
exec $cmd