dashboard sync app
This commit is contained in:
187
install.sh
Executable file
187
install.sh
Executable file
@@ -0,0 +1,187 @@
|
||||
#!/bin/bash
|
||||
# Installation script for luk
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colored output
|
||||
print_status() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Check if Python 3.12+ is installed
|
||||
check_python() {
|
||||
print_status "Checking Python installation..."
|
||||
|
||||
if command -v python3 &> /dev/null; then
|
||||
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
|
||||
REQUIRED_VERSION="3.12"
|
||||
|
||||
if python3 -c "import sys; exit(0 if sys.version_info >= (3, 12) else 1)"; then
|
||||
print_status "Python $PYTHON_VERSION found ✓"
|
||||
else
|
||||
print_error "Python $REQUIRED_VERSION or higher is required. Found: $PYTHON_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_error "Python 3 is not installed"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if uv is installed, install if not
|
||||
check_uv() {
|
||||
print_status "Checking uv installation..."
|
||||
|
||||
if command -v uv &> /dev/null; then
|
||||
print_status "uv found ✓"
|
||||
else
|
||||
print_warning "uv not found, installing..."
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
|
||||
if command -v uv &> /dev/null; then
|
||||
print_status "uv installed successfully ✓"
|
||||
else
|
||||
print_error "Failed to install uv"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Install the package
|
||||
install_package() {
|
||||
print_status "Installing luk..."
|
||||
|
||||
# Create virtual environment and install
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -e .
|
||||
|
||||
print_status "Installation completed ✓"
|
||||
}
|
||||
|
||||
# Setup configuration directories
|
||||
setup_config() {
|
||||
print_status "Setting up configuration directories..."
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p "$HOME/.config/luk"
|
||||
mkdir -p "$HOME/.local/share/luk"
|
||||
mkdir -p "$HOME/.local/share/luk/logs"
|
||||
|
||||
# Create example configuration
|
||||
cat > "$HOME/.config/luk/config.env" << EOF
|
||||
# luk Configuration
|
||||
# Copy this file and modify as needed
|
||||
|
||||
# Microsoft Graph settings
|
||||
# These will be prompted for on first run
|
||||
# MICROSOFT_CLIENT_ID=your_client_id
|
||||
# MICROSOFT_TENANT_ID=your_tenant_id
|
||||
|
||||
# Email settings
|
||||
MAILDIR_PATH=~/Mail
|
||||
NOTES_DIR=~/Documents/Notes
|
||||
|
||||
# Godspeed settings
|
||||
# GODSPEED_EMAIL=your_email@example.com
|
||||
# GODSPEED_PASSWORD=your_password
|
||||
# GODSPEED_TOKEN=your_token
|
||||
# GODSPEED_SYNC_DIR=~/Documents/Godspeed
|
||||
|
||||
# TickTick settings
|
||||
# TICKTICK_CLIENT_ID=your_client_id
|
||||
# TICKTICK_CLIENT_SECRET=your_client_secret
|
||||
|
||||
# Sync settings
|
||||
DEFAULT_ORG=corteva
|
||||
DEFAULT_CALENDAR_DIR=~/Calendar
|
||||
SYNC_INTERVAL=300 # 5 minutes
|
||||
LOG_LEVEL=INFO
|
||||
EOF
|
||||
|
||||
print_status "Configuration directories created ✓"
|
||||
print_warning "Please edit $HOME/.config/luk/config.env with your settings"
|
||||
}
|
||||
|
||||
# Create shell completions
|
||||
setup_completions() {
|
||||
print_status "Setting up shell completions..."
|
||||
|
||||
# Get the shell type
|
||||
SHELL_TYPE=$(basename "$SHELL")
|
||||
|
||||
case $SHELL_TYPE in
|
||||
bash)
|
||||
echo 'eval "$(_LUK_COMPLETE=bash_source luk)"' >> "$HOME/.bashrc"
|
||||
print_status "Bash completions added to ~/.bashrc"
|
||||
;;
|
||||
zsh)
|
||||
echo 'eval "$(_LUK_COMPLETE=zsh_source luk)"' >> "$HOME/.zshrc"
|
||||
print_status "Zsh completions added to ~/.zshrc"
|
||||
;;
|
||||
fish)
|
||||
echo 'luk --completion | source' >> "$HOME/.config/fish/config.fish"
|
||||
print_status "Fish completions added to ~/.config/fish/config.fish"
|
||||
;;
|
||||
*)
|
||||
print_warning "Unsupported shell: $SHELL_TYPE"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Run tests
|
||||
run_tests() {
|
||||
print_status "Running tests..."
|
||||
|
||||
source .venv/bin/activate
|
||||
if uv run pytest tests/ -v; then
|
||||
print_status "All tests passed ✓"
|
||||
else
|
||||
print_warning "Some tests failed, but installation will continue"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main installation flow
|
||||
main() {
|
||||
echo
|
||||
echo " luk - Look at your Outlook data locally"
|
||||
echo " ========================================="
|
||||
echo
|
||||
print_status "Starting luk installation..."
|
||||
|
||||
check_python
|
||||
check_uv
|
||||
install_package
|
||||
setup_config
|
||||
setup_completions
|
||||
run_tests
|
||||
|
||||
print_status "Installation completed successfully! 🎉"
|
||||
echo
|
||||
print_status "To get started:"
|
||||
echo " 1. Source your shell profile: source ~/.bashrc (or ~/.zshrc)"
|
||||
echo " 2. Configure your settings in ~/.config/luk/config.env"
|
||||
echo " 3. Run: luk sync --help"
|
||||
echo " 4. Try the dashboard: luk sync run --dashboard"
|
||||
echo " 5. Start the daemon: luk sync run --daemon"
|
||||
echo
|
||||
print_status "For more information, see: https://github.com/timothybendt/luk"
|
||||
}
|
||||
|
||||
# Run the installation
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user