From c010ad4ceb4e213a0748bd29e2b4748dafc3bbc0 Mon Sep 17 00:00:00 2001 From: Ricardo <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:45:27 -0600 Subject: [PATCH 1/8] feat: add global command installation and usage documentation --- Makefile | 6 +- README.md | 62 +++++++++- install-global-commands.sh | 248 +++++++++++++++++++++++++++++++++++++ 3 files changed, 314 insertions(+), 2 deletions(-) create mode 100755 install-global-commands.sh diff --git a/Makefile b/Makefile index 5885b35..e33129b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # LazyVim Docker - Makefile # Provides easy-to-use commands for managing the LazyVim Docker environment -.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart +.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global # Default target .DEFAULT_GOAL := help @@ -154,3 +154,7 @@ bump-version: ## Bump version (patch, minor, major) exit 1; \ fi @./scripts/bump-version.sh $(TYPE) + +install-global: ## Install global 'lazy' commands to use from anywhere + @echo "$(BLUE)Installing LazyVim Docker global commands...$(NC)" + @./install-global-commands.sh diff --git a/README.md b/README.md index 17e9d57..eec902f 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ make enter # Enter the container ## 🎯 Main Commands +### Local Commands (from project directory) ```bash make help # Show all available commands make enter # 🔥 DAILY USE: Enter container (starts automatically if stopped) @@ -45,12 +46,71 @@ make build # ⚠️ ONLY for first time or major updates make destroy # ⚠️ DANGEROUS: Removes everything ``` -> 💡 **For daily development**: Just use `make enter` - it handles everything! +### Global Commands (from anywhere) +After running `make install-global`, you can use these commands from any directory: +```bash +lazy enter # 🔥 Enter LazyVim from anywhere! +lazy start # Start the container +lazy stop # Stop the container +lazy status # Check container status +lazy health # Run diagnostics +lazy # Show all available commands +``` + +> 💡 **For daily development**: Use `lazy enter` from anywhere - it handles everything! + +**Install global commands:** +```bash +# Run this once from the project directory +make install-global +``` For detailed workflow and troubleshooting: **[📖 Container Lifecycle Guide](docs/CONTAINER_LIFECYCLE.md)** --- +## 🌍 Global Commands Setup + +You can install global commands to use LazyVim Docker from anywhere without navigating to the project directory. + +### Quick Setup +```bash +# From the lazyvim-docker directory +make install-global + +# Reload your shell +source ~/.zshrc # or source ~/.bashrc +``` + +### Usage Examples +```bash +# Work from your Desktop +cd ~/Desktop +lazy enter # Enter LazyVim instantly! + +# Check status from any project +cd ~/Projects/my-app +lazy status # Check if LazyVim is running + +# Start from anywhere +lazy start # Start the container +lazy health # Run full diagnostics +``` + +### Available Global Commands +- `lazy enter` - Enter LazyVim (most used!) +- `lazy start` - Start the container +- `lazy stop` - Stop the container +- `lazy status` - Check container status +- `lazy health` - Run health diagnostics +- `lazy build` - Build/rebuild container +- `lazy help` - Show all make commands +- `lazy` - Show global commands help + +> 🚀 **Game Changer**: Once installed, just type `lazy enter` from anywhere and start coding! + +--- + ## 🔧 Configuration ### Timezone Configuration diff --git a/install-global-commands.sh b/install-global-commands.sh new file mode 100755 index 0000000..50332fa --- /dev/null +++ b/install-global-commands.sh @@ -0,0 +1,248 @@ +#!/bin/bash + +# LazyVim Docker Global Commands Installer +# This script installs global commands to use LazyVim Docker from anywhere + +set -e + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +# Functions +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Get the absolute path of the lazyvim-docker directory +LAZYVIM_DOCKER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +log_info "LazyVim Docker Global Commands Installer" +echo "" +log_info "This will install global 'lazy' commands that you can use from anywhere:" +echo " lazy start -> make start" +echo " lazy enter -> make enter" +echo " lazy stop -> make stop" +echo " lazy status -> make status" +echo " lazy build -> make build" +echo " lazy health -> make health" +echo " lazy help -> make help" +echo "" + +# Check if we're in the correct directory +if [[ ! -f "Makefile" ]] || [[ ! -f "docker-compose.yml" ]]; then + log_error "This script must be run from the lazyvim-docker directory" + exit 1 +fi + +# Function to install for Zsh +install_zsh() { + local shell_config="$HOME/.zshrc" + local marker_start="# LazyVim Docker Global Commands - START" + local marker_end="# LazyVim Docker Global Commands - END" + + # Remove existing installation if present + if grep -q "$marker_start" "$shell_config" 2>/dev/null; then + log_info "Removing existing installation..." + sed -i.bak "/$marker_start/,/$marker_end/d" "$shell_config" + fi + + log_info "Installing global commands for Zsh..." + + # Add the new configuration + cat >> "$shell_config" << EOF + +$marker_start +# LazyVim Docker - Global Commands +# Use 'lazy ' from anywhere to control LazyVim Docker +lazyvim_docker_path="$LAZYVIM_DOCKER_PATH" + +lazy() { + if [[ \$# -eq 0 ]]; then + echo "LazyVim Docker - Global Commands" + echo "" + echo "Usage: lazy " + echo "" + echo "Available commands:" + echo " help Show all available commands" + echo " start Start the container" + echo " enter Enter the container (starts if stopped)" + echo " stop Stop the container" + echo " status Show container status" + echo " health Run health diagnostics" + echo " build Build/rebuild the container" + echo " restart Restart the container" + echo " destroy Destroy everything" + echo " clean Clean up Docker resources" + echo " quick Quick start (build + enter)" + echo " logs Show container logs" + echo " backup Backup configurations" + echo " version Show version" + echo "" + echo "Examples:" + echo " lazy enter # Enter LazyVim from anywhere" + echo " lazy status # Check container status" + echo " lazy health # Run full diagnostics" + echo "" + return 0 + fi + + local cmd="\$1" + shift + + case "\$cmd" in + help|start|enter|stop|status|health|build|restart|destroy|clean|quick|logs|backup|version) + echo "🚀 Running: make \$cmd \$@" + (cd "\$lazyvim_docker_path" && make "\$cmd" "\$@") + ;; + *) + echo "❌ Unknown command: \$cmd" + echo "💡 Use 'lazy' to see available commands" + return 1 + ;; + esac +} + +# Tab completion for lazy command +_lazy_completion() { + local commands=(help start enter stop status health build restart destroy clean quick logs backup version) + _describe 'commands' commands +} + +if [[ -n "\$ZSH_VERSION" ]]; then + compdef _lazy_completion lazy +fi +$marker_end +EOF + + log_success "Zsh configuration updated!" +} + +# Function to install for Bash +install_bash() { + local shell_config="$HOME/.bashrc" + local marker_start="# LazyVim Docker Global Commands - START" + local marker_end="# LazyVim Docker Global Commands - END" + + # Remove existing installation if present + if grep -q "$marker_start" "$shell_config" 2>/dev/null; then + log_info "Removing existing installation..." + sed -i.bak "/$marker_start/,/$marker_end/d" "$shell_config" + fi + + log_info "Installing global commands for Bash..." + + # Add the new configuration + cat >> "$shell_config" << EOF + +$marker_start +# LazyVim Docker - Global Commands +# Use 'lazy ' from anywhere to control LazyVim Docker +lazyvim_docker_path="$LAZYVIM_DOCKER_PATH" + +lazy() { + if [[ \$# -eq 0 ]]; then + echo "LazyVim Docker - Global Commands" + echo "" + echo "Usage: lazy " + echo "" + echo "Available commands:" + echo " help Show all available commands" + echo " start Start the container" + echo " enter Enter the container (starts if stopped)" + echo " stop Stop the container" + echo " status Show container status" + echo " health Run health diagnostics" + echo " build Build/rebuild the container" + echo " restart Restart the container" + echo " destroy Destroy everything" + echo " clean Clean up Docker resources" + echo " quick Quick start (build + enter)" + echo " logs Show container logs" + echo " backup Backup configurations" + echo " version Show version" + echo "" + echo "Examples:" + echo " lazy enter # Enter LazyVim from anywhere" + echo " lazy status # Check container status" + echo " lazy health # Run full diagnostics" + echo "" + return 0 + fi + + local cmd="\$1" + shift + + case "\$cmd" in + help|start|enter|stop|status|health|build|restart|destroy|clean|quick|logs|backup|version) + echo "🚀 Running: make \$cmd \$@" + (cd "\$lazyvim_docker_path" && make "\$cmd" "\$@") + ;; + *) + echo "❌ Unknown command: \$cmd" + echo "💡 Use 'lazy' to see available commands" + return 1 + ;; + esac +} + +# Tab completion for lazy command (basic) +_lazy_completion() { + local cur="\${COMP_WORDS[COMP_CWORD]}" + local commands="help start enter stop status health build restart destroy clean quick logs backup version" + COMPREPLY=(\$(compgen -W "\$commands" -- "\$cur")) +} + +complete -F _lazy_completion lazy +$marker_end +EOF + + log_success "Bash configuration updated!" +} + +# Detect current shell and install accordingly +if [[ -n "$ZSH_VERSION" ]]; then + install_zsh +elif [[ -n "$BASH_VERSION" ]]; then + install_bash +else + log_warning "Unsupported shell. Installing for Zsh by default..." + install_zsh +fi + +echo "" +log_success "Global commands installed successfully!" +echo "" +log_info "To start using the commands:" +echo "" +if [[ -n "$ZSH_VERSION" ]]; then + echo " source ~/.zshrc" +else + echo " source ~/.bashrc" +fi +echo "" +log_info "Or restart your terminal." +echo "" +log_info "Then you can use from anywhere:" +echo " ${GREEN}lazy enter${NC} # Enter LazyVim" +echo " ${GREEN}lazy status${NC} # Check status" +echo " ${GREEN}lazy health${NC} # Run diagnostics" +echo " ${GREEN}lazy${NC} # Show all commands" +echo "" +log_warning "Note: The 'lazy' command will always execute from:" +echo " $LAZYVIM_DOCKER_PATH" From 2dd03dbf3c9abde9d71bd0b020a45d860dc0493a Mon Sep 17 00:00:00 2001 From: Ricardo <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 17:24:07 -0600 Subject: [PATCH 2/8] feat: add uninstall command and refactor global command installation scripts --- Makefile | 8 +- README.md | 32 ++++ .../install-global-commands.sh | 31 ++- scripts/uninstall-global-commands.sh | 177 ++++++++++++++++++ 4 files changed, 237 insertions(+), 11 deletions(-) rename install-global-commands.sh => scripts/install-global-commands.sh (87%) create mode 100755 scripts/uninstall-global-commands.sh diff --git a/Makefile b/Makefile index e33129b..e17b78e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # LazyVim Docker - Makefile # Provides easy-to-use commands for managing the LazyVim Docker environment -.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global +.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall # Default target .DEFAULT_GOAL := help @@ -157,4 +157,8 @@ bump-version: ## Bump version (patch, minor, major) install-global: ## Install global 'lazy' commands to use from anywhere @echo "$(BLUE)Installing LazyVim Docker global commands...$(NC)" - @./install-global-commands.sh + @./scripts/install-global-commands.sh + +uninstall: ## Uninstall LazyVim Docker and remove global commands + @echo "$(BLUE)Uninstalling LazyVim Docker...$(NC)" + @./scripts/uninstall-global-commands.sh diff --git a/README.md b/README.md index eec902f..9b5a84e 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ lazy start # Start the container lazy stop # Stop the container lazy status # Check container status lazy health # Run diagnostics +lazy uninstall # Remove global commands lazy # Show all available commands ``` @@ -105,10 +106,41 @@ lazy health # Run full diagnostics - `lazy health` - Run health diagnostics - `lazy build` - Build/rebuild container - `lazy help` - Show all make commands +- `lazy uninstall` - Remove global commands and optionally the project - `lazy` - Show global commands help > 🚀 **Game Changer**: Once installed, just type `lazy enter` from anywhere and start coding! +### Uninstalling Global Commands + +If you want to remove the global commands: + +```bash +# Option 1: Use the global uninstall command (from anywhere) +lazy uninstall + +# Option 2: Use make from the project directory +make uninstall +``` + +The uninstaller will: +- Remove the `lazy` command from your shell configuration +- Optionally remove the entire project directory +- Clean up Docker containers and images +- Create backups of your shell config files + +#### Manual Cleanup +If you need to manually remove the commands from your shell: +```bash +# Edit your shell config file +nano ~/.zshrc # or ~/.bashrc + +# Remove the section between these markers: +# LazyVim Docker Global Commands - START +# ... (remove everything between markers) +# LazyVim Docker Global Commands - END +``` + --- ## 🔧 Configuration diff --git a/install-global-commands.sh b/scripts/install-global-commands.sh similarity index 87% rename from install-global-commands.sh rename to scripts/install-global-commands.sh index 50332fa..630de89 100755 --- a/install-global-commands.sh +++ b/scripts/install-global-commands.sh @@ -35,13 +35,14 @@ LAZYVIM_DOCKER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" log_info "LazyVim Docker Global Commands Installer" echo "" log_info "This will install global 'lazy' commands that you can use from anywhere:" -echo " lazy start -> make start" -echo " lazy enter -> make enter" -echo " lazy stop -> make stop" -echo " lazy status -> make status" -echo " lazy build -> make build" -echo " lazy health -> make health" -echo " lazy help -> make help" +echo " lazy start -> make start" +echo " lazy enter -> make enter" +echo " lazy stop -> make stop" +echo " lazy status -> make status" +echo " lazy build -> make build" +echo " lazy health -> make health" +echo " lazy help -> make help" +echo " lazy uninstall -> Complete uninstall" echo "" # Check if we're in the correct directory @@ -93,11 +94,13 @@ lazy() { echo " logs Show container logs" echo " backup Backup configurations" echo " version Show version" + echo " uninstall Remove global commands" echo "" echo "Examples:" echo " lazy enter # Enter LazyVim from anywhere" echo " lazy status # Check container status" echo " lazy health # Run full diagnostics" + echo " lazy uninstall # Remove global commands" echo "" return 0 fi @@ -110,6 +113,10 @@ lazy() { echo "🚀 Running: make \$cmd \$@" (cd "\$lazyvim_docker_path" && make "\$cmd" "\$@") ;; + uninstall) + echo "🗑️ Running uninstaller..." + (cd "\$lazyvim_docker_path" && bash uninstall-global-commands.sh) + ;; *) echo "❌ Unknown command: \$cmd" echo "💡 Use 'lazy' to see available commands" @@ -120,7 +127,7 @@ lazy() { # Tab completion for lazy command _lazy_completion() { - local commands=(help start enter stop status health build restart destroy clean quick logs backup version) + local commands=(help start enter stop status health build restart destroy clean quick logs backup version uninstall) _describe 'commands' commands } @@ -176,11 +183,13 @@ lazy() { echo " logs Show container logs" echo " backup Backup configurations" echo " version Show version" + echo " uninstall Remove global commands" echo "" echo "Examples:" echo " lazy enter # Enter LazyVim from anywhere" echo " lazy status # Check container status" echo " lazy health # Run full diagnostics" + echo " lazy uninstall # Remove global commands" echo "" return 0 fi @@ -193,6 +202,10 @@ lazy() { echo "🚀 Running: make \$cmd \$@" (cd "\$lazyvim_docker_path" && make "\$cmd" "\$@") ;; + uninstall) + echo "🗑️ Running uninstaller..." + (cd "\$lazyvim_docker_path" && bash uninstall-global-commands.sh) + ;; *) echo "❌ Unknown command: \$cmd" echo "💡 Use 'lazy' to see available commands" @@ -204,7 +217,7 @@ lazy() { # Tab completion for lazy command (basic) _lazy_completion() { local cur="\${COMP_WORDS[COMP_CWORD]}" - local commands="help start enter stop status health build restart destroy clean quick logs backup version" + local commands="help start enter stop status health build restart destroy clean quick logs backup version uninstall" COMPREPLY=(\$(compgen -W "\$commands" -- "\$cur")) } diff --git a/scripts/uninstall-global-commands.sh b/scripts/uninstall-global-commands.sh new file mode 100755 index 0000000..bfff05b --- /dev/null +++ b/scripts/uninstall-global-commands.sh @@ -0,0 +1,177 @@ +#!/bin/bash + +# uninstall-global-commands.sh +# Script to remove LazyVim Docker global commands from shell configuration files + +set -e + +# Color codes for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Configuration +FUNCTION_NAME="lazy" +START_MARKER="# LazyVim Docker Global Commands - START" +END_MARKER="# LazyVim Docker Global Commands - END" + +# Print colored output +print_status() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +print_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +print_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Function to remove commands from a specific shell config file +remove_from_config() { + local config_file="$1" + local shell_name="$2" + + if [[ ! -f "$config_file" ]]; then + print_warning "$shell_name config file not found: $config_file" + return 0 + fi + + # Check if our commands are present + if ! grep -q "$START_MARKER" "$config_file" 2>/dev/null; then + print_warning "LazyVim Docker commands not found in $config_file" + return 0 + fi + + print_status "Removing LazyVim Docker commands from $config_file..." + + # Create a backup + cp "$config_file" "${config_file}.bak.$(date +%Y%m%d-%H%M%S)" + print_status "Backup created: ${config_file}.bak.$(date +%Y%m%d-%H%M%S)" + + # Remove the section between markers (including the markers) + if sed -i.tmp "/$START_MARKER/,/$END_MARKER/d" "$config_file" 2>/dev/null; then + rm -f "${config_file}.tmp" + print_success "Successfully removed LazyVim Docker commands from $shell_name config" + return 0 + else + print_error "Failed to remove commands from $config_file" + return 1 + fi +} + +# Function to remove global commands from shell configs +remove_global_commands() { + local removed_any=false + + print_status "Removing LazyVim Docker global commands from shell configurations..." + + # Remove from Zsh + if remove_from_config "$HOME/.zshrc" "Zsh"; then + removed_any=true + fi + + # Remove from Bash + if remove_from_config "$HOME/.bashrc" "Bash"; then + removed_any=true + fi + + # Also check ~/.bash_profile (macOS) + if remove_from_config "$HOME/.bash_profile" "Bash Profile"; then + removed_any=true + fi + + if [[ "$removed_any" == true ]]; then + print_success "Global commands have been removed from shell configurations" + print_status "Please restart your terminal or run 'source ~/.zshrc' (or ~/.bashrc) to apply changes" + return 0 + else + print_warning "No LazyVim Docker commands were found in any shell configuration files" + return 1 + fi +} + +# Function to optionally remove the project directory +remove_project_directory() { + local project_dir + project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + + echo + print_status "Current project directory: $project_dir" + echo + echo -n "Do you want to remove the entire LazyVim Docker project directory? [y/N]: " + read -r response + + case "$response" in + [yY][eE][sS]|[yY]) + print_status "Removing project directory: $project_dir" + + # Stop and remove containers first + if command -v docker-compose >/dev/null 2>&1 || command -v docker >/dev/null 2>&1; then + print_status "Stopping and removing Docker containers..." + cd "$project_dir" + make destroy 2>/dev/null || { + print_warning "Could not run 'make destroy'. Attempting manual cleanup..." + docker-compose down -v 2>/dev/null || docker compose down -v 2>/dev/null || true + docker rmi lazyvim-docker_code-editor 2>/dev/null || true + } + fi + + # Remove the directory + cd "$HOME" + if rm -rf "$project_dir"; then + print_success "Project directory removed successfully" + else + print_error "Failed to remove project directory. You may need to remove it manually:" + print_error " rm -rf '$project_dir'" + fi + ;; + *) + print_status "Project directory preserved: $project_dir" + print_status "You can manually remove it later if needed" + ;; + esac +} + +# Main function +main() { + echo + echo -e "${BLUE}╔══════════════════════════════════════════════════════════════╗${NC}" + echo -e "${BLUE}║ LazyVim Docker - Uninstaller ║${NC}" + echo -e "${BLUE}╚══════════════════════════════════════════════════════════════╝${NC}" + echo + + # Remove global commands + if remove_global_commands; then + echo + print_success "✓ Global 'lazy' commands removed from shell configurations" + else + echo + print_warning "⚠ No global commands were found to remove" + fi + + # Ask about removing project directory + remove_project_directory + + echo + print_success "Uninstallation completed!" + echo + print_status "What was removed:" + print_status " • Global 'lazy' command and tab completion" + print_status " • LazyVim Docker functions from shell configs" + echo + print_status "If you removed the project directory, all Docker containers and images were also cleaned up." + echo + print_status "Thank you for using LazyVim Docker! 🚀" + echo +} + +# Run main function +main "$@" From dd5a30522d3765d8c2937e45606b79d70223c718 Mon Sep 17 00:00:00 2001 From: Ricardo <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 20:55:49 -0600 Subject: [PATCH 3/8] feat: add remote installation, uninstallation, and update scripts for LazyVim Docker --- Makefile | 23 +- README.md | 512 ++++++++++++++------------- VERSION | 2 +- scripts/remote-install.sh | 287 +++++++++++++++ scripts/remote-uninstall.sh | 198 +++++++++++ scripts/remote-update.sh | 225 ++++++++++++ scripts/uninstall-global-commands.sh | 4 +- 7 files changed, 1004 insertions(+), 247 deletions(-) create mode 100755 scripts/remote-install.sh create mode 100755 scripts/remote-uninstall.sh create mode 100755 scripts/remote-update.sh diff --git a/Makefile b/Makefile index e17b78e..83c7b37 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # LazyVim Docker - Makefile # Provides easy-to-use commands for managing the LazyVim Docker environment -.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall +.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall remote-install remote-uninstall remote-update # Default target .DEFAULT_GOAL := help @@ -162,3 +162,24 @@ install-global: ## Install global 'lazy' commands to use from anywhere uninstall: ## Uninstall LazyVim Docker and remove global commands @echo "$(BLUE)Uninstalling LazyVim Docker...$(NC)" @./scripts/uninstall-global-commands.sh + +install-remote: ## Show remote installation command + @echo "$(BLUE)LazyVim Docker - Remote Installation$(NC)" + @echo "" + @echo "To install LazyVim Docker remotely (recommended):" + @echo "$(GREEN)curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash$(NC)" + @echo "" + @echo "This will:" + @echo " • Download and install LazyVim Docker to ~/.local/share/lazyvim-docker" + @echo " • Create global 'lazy' command" + @echo " • Build Docker environment" + @echo " • No repository cloning required - everything is automated" + +remote-install: install-remote ## Alias for install-remote + +test-remote-scripts: ## Test remote installation scripts locally + @echo "$(BLUE)Testing remote installation scripts...$(NC)" + @bash -n scripts/remote-install.sh && echo "$(GREEN)✓ remote-install.sh syntax OK$(NC)" + @bash -n scripts/remote-uninstall.sh && echo "$(GREEN)✓ remote-uninstall.sh syntax OK$(NC)" + @bash -n scripts/remote-update.sh && echo "$(GREEN)✓ remote-update.sh syntax OK$(NC)" + @echo "$(GREEN)All remote scripts passed syntax check!$(NC)" diff --git a/README.md b/README.md index 9b5a84e..49fda4f 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,24 @@ A professional Dockerized environment for LazyVim (advanced Neovim configuration ## 🚀 Quick Start -### One-Line Installation (Recommended) +### 🌐 Remote Installation (Recommended) +Install directly without cloning the repository - no manual setup needed: + +```bash +# One-line installation +curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash + +# Then use from anywhere +lazy enter # Enter LazyVim development environment +``` + +### 📦 Traditional Installation +If you prefer to clone the repository manually: ```bash git clone https://github.com/manghidev/lazyvim-docker.git && cd lazyvim-docker && make quick ``` -### Manual Installation +### 🔧 Manual Installation ```bash git clone https://github.com/manghidev/lazyvim-docker.git cd lazyvim-docker @@ -27,15 +39,31 @@ make enter # Enter the container - **Dockerized**: Fully isolated and reproducible environment - **Rich Terminal**: Zsh with Oh My Zsh, Powerlevel10k theme, and useful plugins - **40+ Developer Tools**: git, lazygit, tmux, python, node.js, and many more -- **Easy Management**: Simple make commands for all operations +- **Easy Remote Setup**: No need to clone repository manually - just one command +- **Simple Management**: Easy commands for all operations - **Persistent Configuration**: All changes are saved between sessions - **Cross-Platform**: Works on macOS and Linux +- **Auto-Updates**: Built-in update mechanism --- -## 🎯 Main Commands +## 🎯 Commands Overview -### Local Commands (from project directory) +### 🌐 Global Commands (Remote Installation) +After remote installation, use these commands from anywhere: +```bash +lazy enter # 🔥 Enter LazyVim development environment +lazy start # Start the container +lazy stop # Stop the container +lazy status # Check container status +lazy build # Build/rebuild environment +lazy update # Update to latest version +lazy uninstall # Complete removal +lazy help # Show all available commands +``` + +### 📁 Local Commands (Traditional Installation) +From the project directory: ```bash make help # Show all available commands make enter # 🔥 DAILY USE: Enter container (starts automatically if stopped) @@ -46,331 +74,329 @@ make build # ⚠️ ONLY for first time or major updates make destroy # ⚠️ DANGEROUS: Removes everything ``` -### Global Commands (from anywhere) -After running `make install-global`, you can use these commands from any directory: -```bash -lazy enter # 🔥 Enter LazyVim from anywhere! -lazy start # Start the container -lazy stop # Stop the container -lazy status # Check container status -lazy health # Run diagnostics -lazy uninstall # Remove global commands -lazy # Show all available commands -``` - -> 💡 **For daily development**: Use `lazy enter` from anywhere - it handles everything! - -**Install global commands:** -```bash -# Run this once from the project directory -make install-global -``` - -For detailed workflow and troubleshooting: **[📖 Container Lifecycle Guide](docs/CONTAINER_LIFECYCLE.md)** +> 💡 **For daily development**: Use `lazy enter` (remote) or `make enter` (traditional) --- -## 🌍 Global Commands Setup +## 🌐 Remote Installation Scripts -You can install global commands to use LazyVim Docker from anywhere without navigating to the project directory. +LazyVim Docker provides three main remote scripts for easy management: -### Quick Setup -```bash -# From the lazyvim-docker directory -make install-global +### 📥 Installation Script +**`remote-install.sh`** - Complete setup in one command -# Reload your shell -source ~/.zshrc # or source ~/.bashrc -``` - -### Usage Examples ```bash -# Work from your Desktop -cd ~/Desktop -lazy enter # Enter LazyVim instantly! +# Full installation with Docker build +curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash +``` -# Check status from any project -cd ~/Projects/my-app -lazy status # Check if LazyVim is running +**What it does:** +- ✅ Checks system requirements (Docker, git, curl) +- ✅ Downloads LazyVim Docker to `~/.local/share/lazyvim-docker` +- ✅ Creates global `lazy` command in `~/.local/bin` +- ✅ Adds `~/.local/bin` to your PATH automatically +- ✅ Builds Docker environment (may take a few minutes) +- ✅ Creates shell configuration backups -# Start from anywhere -lazy start # Start the container -lazy health # Run full diagnostics -``` +### 🔄 Update Script +**`remote-update.sh`** - Keep your installation up to date -### Available Global Commands -- `lazy enter` - Enter LazyVim (most used!) -- `lazy start` - Start the container -- `lazy stop` - Stop the container -- `lazy status` - Check container status -- `lazy health` - Run health diagnostics -- `lazy build` - Build/rebuild container -- `lazy help` - Show all make commands -- `lazy uninstall` - Remove global commands and optionally the project -- `lazy` - Show global commands help +```bash +# Update to latest version +lazy update -> 🚀 **Game Changer**: Once installed, just type `lazy enter` from anywhere and start coding! +# Or run directly +curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-update.sh | bash +``` -### Uninstalling Global Commands +**What it does:** +- ✅ Checks current vs latest version +- ✅ Creates backup of current installation +- ✅ Downloads latest version +- ✅ Preserves user configurations (.dotfiles, backups) +- ✅ Updates installation while keeping your settings +- ✅ Optionally rebuilds Docker containers -If you want to remove the global commands: +### 🗑️ Uninstallation Script +**`remote-uninstall.sh`** - Complete cleanup ```bash -# Option 1: Use the global uninstall command (from anywhere) +# Uninstall everything with prompts lazy uninstall -# Option 2: Use make from the project directory -make uninstall +# Or run directly +curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-uninstall.sh | bash ``` -The uninstaller will: -- Remove the `lazy` command from your shell configuration -- Optionally remove the entire project directory -- Clean up Docker containers and images -- Create backups of your shell config files +**What it does:** +- ✅ Stops and removes Docker containers/images +- ✅ Removes installation directory (`~/.local/share/lazyvim-docker`) +- ✅ Removes global `lazy` command +- ✅ Optionally cleans PATH modifications from shell configs +- ✅ Creates backups before making changes +- ✅ Interactive prompts for safety -#### Manual Cleanup -If you need to manually remove the commands from your shell: -```bash -# Edit your shell config file -nano ~/.zshrc # or ~/.bashrc +--- -# Remove the section between these markers: -# LazyVim Docker Global Commands - START -# ... (remove everything between markers) -# LazyVim Docker Global Commands - END -``` +## 🔬 Script Details & Technical Info + +### 📥 remote-install.sh +**Purpose**: Complete LazyVim Docker setup without repository cloning + +**Requirements Check:** +- Docker (with compose support) +- Git (for downloading) +- Curl (for execution) +- Supported OS: macOS, Linux + +**Installation Process:** +1. Creates `~/.local/share/lazyvim-docker` directory +2. Downloads latest repository to temp location +3. Moves files to installation directory +4. Creates global `lazy` command in `~/.local/bin` +5. Updates shell PATH in `.zshrc`/`.bashrc` +6. Builds Docker environment (5-10 minutes) +7. Cleans up temporary files + +**Files Modified:** +- `~/.zshrc` or `~/.bashrc` (adds PATH) +- Creates `~/.local/bin/lazy` +- Creates `~/.local/share/lazyvim-docker/` + +### 🔄 remote-update.sh +**Purpose**: Update existing remote installation to latest version + +**Update Process:** +1. Checks current version vs latest GitHub release +2. Creates backup of current installation +3. Downloads latest version to temp directory +4. Preserves user configurations (.dotfiles, backups) +5. Replaces system files while keeping user data +6. Optionally rebuilds Docker containers +7. Cleans up temporary files + +**Preserved Data:** +- `.dotfiles/` (your Neovim, shell configs) +- `backups/` (configuration backups) +- Docker volumes (development data) + +**Safe Rollback:** +- Backup created before update in `~/.local/share/lazyvim-docker-backup-[timestamp]` + +### 🗑️ remote-uninstall.sh +**Purpose**: Complete removal of LazyVim Docker installation + +**Removal Process:** +1. Stops all running containers +2. Removes Docker containers and images +3. Removes Docker volumes +4. Removes installation directory +5. Removes global `lazy` command +6. Optionally cleans PATH from shell configs +7. Creates backups before deletion + +**Interactive Prompts:** +- Confirm complete uninstall +- Choose to remove PATH modifications +- Option to keep or remove project files + +**Cleanup Scope:** +- Docker: containers, images, volumes +- Files: installation directory, global command +- Config: PATH modifications (optional) --- -## 🔧 Configuration - -### Timezone Configuration -Configure your local timezone to match the container time. Edit the `docker-compose.yml` file: +## 📋 Installation Methods Comparison -```yaml -# In docker-compose.yml, modify these lines: -services: - code-editor: - build: - args: - VERSION: x.x.x - TIMEZONE: America/Mexico_City # Change to your timezone - environment: - - TZ=America/Mexico_City # Change to your timezone -``` +| Method | Command | Best For | Global Access | +|--------|---------|----------|---------------| +| **Remote Install** | `curl ... \| bash` | End users, daily use | ✅ `lazy` anywhere | +| **Traditional** | `git clone ...` | Developers, customization | ❌ Must `cd` to directory | +| **Quick Install** | `curl quick-install.sh` | Fast setup | ✅ `lazy` anywhere | -Common timezones: -- `America/Mexico_City` (UTC-6) -- `America/New_York` (UTC-5/-4) -- `America/Los_Angeles` (UTC-8/-7) -- `Europe/Madrid` (UTC+1/+2) -- `Europe/London` (UTC+0/+1) -- `Asia/Tokyo` (UTC+9) +### Switching Between Methods -After changing the timezone, rebuild the container: +**From Traditional to Remote:** ```bash -make build +# From your existing repo directory +make destroy && cd .. && rm -rf lazyvim-docker +curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash ``` -Check the current timezone configuration: +**From Remote to Traditional:** ```bash -make timezone +lazy uninstall +git clone https://github.com/manghidev/lazyvim-docker.git && cd lazyvim-docker && make quick ``` -### Volume Mounting -By default, your `Documents` folder is mounted. Edit `docker-compose.yml` to add more directories: +--- -```yaml -volumes: - # Already included - - $HOME/Documents:/home/developer/Documents - - # Add your project directories - - $HOME/Projects:/home/developer/Projects - - $HOME/Developer:/home/developer/Developer -``` +## 🎯 Daily Usage Guide -### Initial Setup -Run the interactive setup for personalized configuration: +### Remote Installation Workflow (Recommended) ```bash -make build # First build the environment +# 1. Install once (5-10 minutes) +curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash + +# 2. Daily usage from anywhere +cd ~/Projects/my-project +lazy enter # Start coding immediately + +# 3. Management commands +lazy status # Check if running +lazy stop # Stop when done +lazy update # Update weekly/monthly ``` ---- +### Traditional Installation Workflow +```bash +# 1. Install once +git clone https://github.com/manghidev/lazyvim-docker.git && cd lazyvim-docker && make quick -## 📁 Project Structure +# 2. Daily usage (must be in project directory) +cd path/to/lazyvim-docker +make enter # Start coding -``` -lazyvim-docker/ -├── Makefile # Main command interface -├── docker-compose.yml # Docker configuration -├── Dockerfile # Container definition -├── VERSION # Current version -├── docs/ # Documentation -│ ├── COMMANDS.md # Complete command reference -│ └── CHANGELOG.md # Version history -├── scripts/ # Internal scripts (always use make commands instead) -│ ├── build.sh # Build script -│ ├── init.sh # Init script -│ ├── destroy.sh # Destroy script -│ ├── setup.sh # Interactive setup -│ ├── health-check.sh # Environment diagnostics -│ └── bump-version.sh # Version management -└── .dotfiles/ # Persistent configuration - ├── .zshrc # Shell configuration - ├── .p10k.zsh # Theme configuration - └── .config/ # App configurations - ├── nvim/ # Neovim/LazyVim - └── lazygit/ # Git TUI +# 3. Management +make status && make stop ``` ---- +For detailed workflow and troubleshooting: **[📖 Container Lifecycle Guide](docs/CONTAINER_LIFECYCLE.md)** -## 🛠️ Included Tools +--- -**Core Development:** -- Neovim with LazyVim configuration -- Git + Lazygit (Git TUI) -- Node.js LTS + npm -- Python 3 + pip with dev packages +## 🔧 Advanced Configuration -**Terminal Enhancement:** -- Zsh with Oh My Zsh + Powerlevel10k -- fzf (fuzzy finder), ripgrep (fast search) -- bat (better cat), exa (better ls), fd (better find) -- tmux (terminal multiplexer) +## 🔧 Advanced Configuration -**System Tools:** -- htop, tree, curl, wget -- make, cmake, g++ -- jq, yq (JSON/YAML processors) +### Timezone Configuration +Configure your timezone in `docker-compose.yml`: ---- +```yaml +services: + code-editor: + build: + args: + TIMEZONE: America/Mexico_City # Change this + environment: + - TZ=America/Mexico_City # And this +``` -## 🩺 Health & Maintenance +**Common timezones:** Mexico_City, New_York, Los_Angeles, Madrid, London, Tokyo +**Apply changes:** ```bash -make status # Check container status -make health # Run comprehensive diagnostics -make backup # Backup configurations -make clean # Clean up Docker resources +lazy build # Remote installation +make build # Traditional installation ``` ---- - -## 🔄 Version Management +### Volume Mounting +Add your project directories in `docker-compose.yml`: -```bash -make version # Show current version -make bump-version TYPE=patch # Bump version (patch/minor/major) +```yaml +volumes: + - $HOME/Documents:/home/developer/Documents # Default + - $HOME/Projects:/home/developer/Projects # Add this + - $HOME/Developer:/home/developer/Developer # Or this ``` --- -## 🐛 Troubleshooting +## 🩺 Maintenance & Troubleshooting -**Container won't start:** +### Health Check Commands ```bash -make status # Check what's wrong -make destroy # Nuclear option: rebuild everything -make build +lazy status # Container status +lazy help # Available commands +make health # Comprehensive diagnostics (traditional) ``` -**Need fresh start:** +### Common Solutions ```bash -make destroy && make build -``` +# Container won't start +lazy stop && lazy start -**Performance issues:** -```bash -make clean # Free up disk space -``` +# Need fresh environment +lazy build ---- +# Update to fix issues +lazy update -## 📚 Documentation - -- **[📖 Complete Commands Reference](docs/COMMANDS.md)** - All available commands and workflows -- **[📝 Changelog](docs/CHANGELOG.md)** - Version history and updates +# Nuclear option +lazy uninstall && curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash +``` --- -**Ready to code? Run `make quick` and start developing! 🚀** - -## 💡 Usage Tips +## � Documentation & Support -### First Time Setup -1. Run the container: `make build` -2. Configure Powerlevel10k theme: `p10k configure` -3. Customize Neovim as needed -4. Set up git: `git config --global user.name "Your Name"` +**Main Documentation:** +- **[📖 Complete Commands Reference](docs/COMMANDS.md)** - All available commands +- **[📝 Changelog](docs/CHANGELOG.md)** - Version history +- **[� Container Lifecycle Guide](docs/CONTAINER_LIFECYCLE.md)** - Detailed workflows -### Daily Workflow -1. Start container: `make start` or `make enter` -2. Work on your projects in mounted directories -3. All changes in .dotfiles are persisted -4. Stop when done: `make stop` +**Quick Start:** +- Remote: `curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash` +- Traditional: `git clone ... && make quick` -### Accessing Your Files -- Documents: `/home/developer/Documents` -- Projects: `/home/developer/Projects` (if configured) -- Custom mounts: As configured in docker-compose.yml - -### Terminal Features -- **Auto-suggestions**: Start typing, get suggestions from history -- **Syntax highlighting**: Commands are highlighted as you type -- **Fast search**: Use `Ctrl+R` for history search with fzf -- **Git integration**: Lazygit with `lg` command or `lazygit` +**Support:** +- 🐛 [Report Issues](https://github.com/manghidev/lazyvim-docker/issues) +- 💡 [Feature Requests](https://github.com/manghidev/lazyvim-docker/issues) +- ⭐ [Star the Project](https://github.com/manghidev/lazyvim-docker) --- -## 🤝 Contributions +## 👨‍💻 About -Contributions are welcome! Here's how you can help: +**Created by ManghiDev** +🌐 [Personal Website](https://manghi.dev) +📧 [GitHub Issues](https://github.com/manghidev/lazyvim-docker/issues) -1. **Fork** the repository -2. **Create** a feature branch: `git checkout -b feature/amazing-feature` -3. **Commit** your changes: `git commit -m 'Add amazing feature'` -4. **Push** to the branch: `git push origin feature/amazing-feature` -5. **Open** a Pull Request +**License:** MIT - See [LICENSE](LICENSE) file -### Development Guidelines -- Follow existing code style -- Add appropriate documentation -- Test your changes -- Update version number if needed +**Additional Resources:** +- [LazyVim Docs](https://lazyvim.github.io/) | [Neovim Docs](https://neovim.io/doc/) +- [Docker Docs](https://docs.docker.com/) | [Oh My Zsh](https://ohmyz.sh/) --- -## 📝 License +## 📚 Quick Reference -This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. +### 🚀 Remote Scripts Commands ---- +| Action | Command | Description | +|--------|---------|-------------| +| **Install** | `curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh \| bash` | Complete setup | +| **Update** | `lazy update` | Update to latest version | +| **Uninstall** | `lazy uninstall` | Remove everything | -## 👨‍💻 Author +### 💻 Daily Commands (After Remote Install) -Created by **ManghiDev** -🌐 Website: [Personal Web](https://manghi.dev) -📧 Contact: [GitHub Issues](https://github.com/manghidev/lazyvim-docker/issues) +| Command | Description | Usage | +|---------|-------------|-------| +| `lazy enter` | Enter development environment | Daily coding | +| `lazy status` | Check container status | Debugging | +| `lazy start` | Start containers | If stopped | +| `lazy stop` | Stop containers | End of day | +| `lazy build` | Rebuild environment | After updates | +| `lazy help` | Show all commands | Reference | ---- +### 🛠️ Troubleshooting Commands -## ⭐ Support +```bash +# Check what's running +lazy status -If you find this project helpful, please consider: -- ⭐ Starring the repository -- 🐛 Reporting bugs -- 💡 Suggesting new features -- 📖 Improving documentation +# Full restart +lazy stop && lazy start ---- +# Nuclear option - rebuild everything +lazy build -## 📚 Additional Resources +# Update to latest version +lazy update -- [LazyVim Documentation](https://lazyvim.github.io/) -- [Neovim Documentation](https://neovim.io/doc/) -- [Docker Documentation](https://docs.docker.com/) -- [Oh My Zsh Documentation](https://ohmyz.sh/) -- [Powerlevel10k Documentation](https://github.com/romkatv/powerlevel10k) \ No newline at end of file +# Complete removal +lazy uninstall +``` \ No newline at end of file diff --git a/VERSION b/VERSION index 26aaba0..f0bb29e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.0 +1.3.0 diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh new file mode 100755 index 0000000..61d4531 --- /dev/null +++ b/scripts/remote-install.sh @@ -0,0 +1,287 @@ +#!/bin/bash + +# LazyVim Docker - Remote Installation Script +# This script downloads and installs LazyVim Docker environment directly from GitHub +# Usage: curl -fsSL https://raw.githubusercontent.com/USER/lazyvim-docker/main/scripts/remote-install.sh | bash + +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +# Configuration +REPO_URL="https://github.com/manghidev/lazyvim-docker" +REPO_NAME="lazyvim-docker" +INSTALL_DIR="$HOME/.local/share/lazyvim-docker" +BIN_DIR="$HOME/.local/bin" +TEMP_DIR="/tmp/lazyvim-docker-install" + +# Print functions +print_header() { + echo -e "${CYAN}╔══════════════════════════════════════════════════════════════╗${NC}" + echo -e "${CYAN}║ LazyVim Docker - Remote Installer ║${NC}" + echo -e "${CYAN}║ Easy One-Command Setup ║${NC}" + echo -e "${CYAN}╚══════════════════════════════════════════════════════════════╝${NC}" + echo "" +} + +print_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +print_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +print_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +print_step() { + echo -e "${PURPLE}[STEP]${NC} $1" +} + +# Check if command exists +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Check system requirements +check_requirements() { + print_step "Checking system requirements..." + + local missing_deps=() + + if ! command_exists curl; then + missing_deps+=("curl") + fi + + if ! command_exists git; then + missing_deps+=("git") + fi + + if ! command_exists docker; then + missing_deps+=("docker") + fi + + if ! command_exists docker && ! docker compose version >/dev/null 2>&1; then + print_warning "Docker or Docker Compose not found." + if ! docker compose version >/dev/null 2>&1; then + missing_deps+=("docker") + fi + fi + + if [ ${#missing_deps[@]} -ne 0 ]; then + print_error "Missing required dependencies: ${missing_deps[*]}" + echo "" + print_info "Please install the missing dependencies and try again:" + echo "" + if [[ "$OSTYPE" == "darwin"* ]]; then + echo " brew install ${missing_deps[*]}" + elif [[ "$OSTYPE" == "linux"* ]]; then + echo " # Ubuntu/Debian:" + echo " sudo apt-get update && sudo apt-get install -y ${missing_deps[*]}" + echo "" + echo " # CentOS/RHEL:" + echo " sudo yum install -y ${missing_deps[*]}" + fi + echo "" + exit 1 + fi + + print_success "All requirements satisfied!" +} + +# Create necessary directories +create_directories() { + print_step "Creating installation directories..." + + mkdir -p "$INSTALL_DIR" + mkdir -p "$BIN_DIR" + mkdir -p "$TEMP_DIR" + + print_success "Directories created successfully" +} + +# Download the repository +download_repository() { + print_step "Downloading LazyVim Docker repository..." + + # Remove temp directory if it exists + rm -rf "$TEMP_DIR" + + # Clone the repository to temp directory + if git clone --depth 1 "$REPO_URL" "$TEMP_DIR" >/dev/null 2>&1; then + print_success "Repository downloaded successfully" + else + print_error "Failed to download repository from $REPO_URL" + exit 1 + fi +} + +# Install the application +install_application() { + print_step "Installing LazyVim Docker..." + + # Remove existing installation + if [ -d "$INSTALL_DIR" ]; then + print_info "Removing existing installation..." + rm -rf "$INSTALL_DIR" + fi + + # Move from temp to install directory + mv "$TEMP_DIR" "$INSTALL_DIR" + + # Make scripts executable + chmod +x "$INSTALL_DIR/scripts/"*.sh + chmod +x "$INSTALL_DIR/Makefile" + + print_success "Application installed to $INSTALL_DIR" +} + +# Create global commands +create_global_commands() { + print_step "Creating global commands..." + + # Create the main lazy command + cat > "$BIN_DIR/lazy" << 'EOF' +#!/bin/bash + +# LazyVim Docker - Global Command +# This script provides global access to LazyVim Docker functionality + +LAZYVIM_INSTALL_DIR="$HOME/.local/share/lazyvim-docker" + +# Check if installation exists +if [ ! -d "$LAZYVIM_INSTALL_DIR" ]; then + echo "❌ LazyVim Docker not found. Please reinstall:" + echo " curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash" + exit 1 +fi + +# Change to install directory and run make command +cd "$LAZYVIM_INSTALL_DIR" + +# Handle special commands +case "$1" in + uninstall) + echo "🗑️ Uninstalling LazyVim Docker..." + bash "$LAZYVIM_INSTALL_DIR/scripts/remote-uninstall.sh" + ;; + update) + echo "🔄 Updating LazyVim Docker..." + bash "$LAZYVIM_INSTALL_DIR/scripts/remote-update.sh" + ;; + *) + # Pass all other commands to make + make "$@" + ;; +esac +EOF + + chmod +x "$BIN_DIR/lazy" + + # Add bin directory to PATH if not already there + add_to_path + + print_success "Global command 'lazy' created" +} + +# Add bin directory to PATH +add_to_path() { + local shell_config="" + local path_line="export PATH=\"\$HOME/.local/bin:\$PATH\"" + + # Determine shell config file + if [[ -n "$ZSH_VERSION" ]]; then + shell_config="$HOME/.zshrc" + elif [[ -n "$BASH_VERSION" ]]; then + shell_config="$HOME/.bashrc" + # Also check .bash_profile on macOS + if [[ "$OSTYPE" == "darwin"* ]] && [[ -f "$HOME/.bash_profile" ]]; then + shell_config="$HOME/.bash_profile" + fi + else + # Default to .bashrc + shell_config="$HOME/.bashrc" + fi + + # Add to PATH if not already there + if ! grep -q "$HOME/.local/bin" "$shell_config" 2>/dev/null; then + echo "" >> "$shell_config" + echo "# LazyVim Docker - Add local bin to PATH" >> "$shell_config" + echo "$path_line" >> "$shell_config" + print_info "Added $HOME/.local/bin to PATH in $shell_config" + fi +} + +# Initial setup +initial_setup() { + print_step "Running initial setup..." + + cd "$INSTALL_DIR" + + # Build the Docker environment + print_info "Building Docker environment (this may take a few minutes)..." + if make build; then + print_success "Docker environment built successfully" + else + print_warning "Docker build failed, but installation completed. You can run 'lazyvim build' later." + fi +} + +# Cleanup +cleanup() { + print_step "Cleaning up temporary files..." + rm -rf "$TEMP_DIR" + print_success "Cleanup completed" +} + +# Main installation process +main() { + print_header + + print_info "Starting LazyVim Docker remote installation..." + print_info "Installation directory: $INSTALL_DIR" + print_info "Binary directory: $BIN_DIR" + echo "" + + check_requirements + create_directories + download_repository + install_application + create_global_commands + initial_setup + cleanup + + echo "" + print_success "🎉 LazyVim Docker installed successfully!" + echo "" + print_info "Usage:" + echo " ${GREEN}lazy enter${NC} # Enter LazyVim development environment" + echo " ${GREEN}lazy start${NC} # Start the container" + echo " ${GREEN}lazy stop${NC} # Stop the container" + echo " ${GREEN}lazy status${NC} # Check container status" + echo " ${GREEN}lazy update${NC} # Update to latest version" + echo " ${GREEN}lazy uninstall${NC} # Uninstall everything" + echo " ${GREEN}lazy help${NC} # Show all available commands" + echo "" + print_info "To get started:" + echo " 1. Restart your terminal or run: ${YELLOW}source ~/.zshrc${NC} (or ~/.bashrc)" + echo " 2. Run: ${GREEN}lazy enter${NC}" + echo "" + print_info "Happy coding! 🚀" +} + +# Run main function +main "$@" diff --git a/scripts/remote-uninstall.sh b/scripts/remote-uninstall.sh new file mode 100755 index 0000000..2e88b47 --- /dev/null +++ b/scripts/remote-uninstall.sh @@ -0,0 +1,198 @@ +#!/bin/bash + +# LazyVim Docker - Remote Uninstall Script +# This script completely removes LazyVim Docker from the system + +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +# Configuration +INSTALL_DIR="$HOME/.local/share/lazyvim-docker" +BIN_DIR="$HOME/.local/bin" + +# Print functions +print_header() { + echo -e "${CYAN}╔══════════════════════════════════════════════════════════════╗${NC}" + echo -e "${CYAN}║ LazyVim Docker - Uninstaller ║${NC}" + echo -e "${CYAN}╚══════════════════════════════════════════════════════════════╝${NC}" + echo "" +} + +print_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +print_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +print_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +print_step() { + echo -e "${PURPLE}[STEP]${NC} $1" +} + +# Stop and remove Docker containers +cleanup_docker() { + print_step "Cleaning up Docker containers and images..." + + if [ -d "$INSTALL_DIR" ]; then + cd "$INSTALL_DIR" + + # Try to run make destroy first + if command -v make >/dev/null 2>&1; then + print_info "Running make destroy..." + make destroy 2>/dev/null || { + print_warning "make destroy failed, attempting manual cleanup..." + } + fi + + # Manual Docker cleanup + if command -v docker >/dev/null 2>&1; then + print_info "Removing Docker containers and images..." + + # Stop and remove containers + docker stop lazyvim 2>/dev/null || true + docker rm lazyvim 2>/dev/null || true + + # Remove images + docker rmi lazyvim-docker_code-editor 2>/dev/null || true + docker rmi $(docker images | grep lazyvim | awk '{print $3}') 2>/dev/null || true + + # Remove volumes + docker volume rm lazyvim-docker_lazyvim-data 2>/dev/null || true + docker volume rm $(docker volume ls | grep lazyvim | awk '{print $2}') 2>/dev/null || true + + print_success "Docker cleanup completed" + else + print_warning "Docker not found, skipping Docker cleanup" + fi + fi +} + +# Remove installation directory +remove_installation() { + print_step "Removing installation directory..." + + if [ -d "$INSTALL_DIR" ]; then + rm -rf "$INSTALL_DIR" + print_success "Installation directory removed: $INSTALL_DIR" + else + print_warning "Installation directory not found: $INSTALL_DIR" + fi +} + +# Remove global command +remove_global_command() { + print_step "Removing global command..." + + if [ -f "$BIN_DIR/lazy" ]; then + rm -f "$BIN_DIR/lazy" + print_success "Global 'lazy' command removed" + else + print_warning "Global command not found: $BIN_DIR/lazy" + fi +} + +# Remove PATH modifications (optional) +remove_path_modifications() { + echo "" + echo -n "Do you want to remove PATH modifications from shell config? [y/N]: " + read -r response + + case "$response" in + [yY][eE][sS]|[yY]) + print_step "Removing PATH modifications..." + + local shell_configs=("$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile") + + for config in "${shell_configs[@]}"; do + if [ -f "$config" ]; then + # Create backup + cp "$config" "${config}.backup.$(date +%Y%m%d-%H%M%S)" + + # Remove LazyVim Docker PATH modifications + sed -i.tmp '/# LazyVim Docker - Add local bin to PATH/d' "$config" 2>/dev/null || true + sed -i.tmp '/export PATH=.*\.local\/bin.*PATH/d' "$config" 2>/dev/null || true + rm -f "${config}.tmp" + + print_info "Cleaned PATH modifications from: $config" + fi + done + + print_success "PATH modifications removed" + ;; + *) + print_info "PATH modifications preserved" + ;; + esac +} + +# Confirm uninstallation +confirm_uninstall() { + echo "" + print_warning "This will completely remove LazyVim Docker from your system:" + echo " • Docker containers and images" + echo " • Installation directory ($INSTALL_DIR)" + echo " • Global 'lazy' command" + echo " • All data and configurations" + echo "" + echo -n "Are you sure you want to continue? [y/N]: " + read -r response + + case "$response" in + [yY][eE][sS]|[yY]) + return 0 + ;; + *) + print_info "Uninstallation cancelled" + exit 0 + ;; + esac +} + +# Main uninstallation process +main() { + print_header + + print_info "LazyVim Docker Uninstaller" + echo "" + + confirm_uninstall + + cleanup_docker + remove_installation + remove_global_command + remove_path_modifications + + echo "" + print_success "🗑️ LazyVim Docker has been completely uninstalled!" + echo "" + print_info "What was removed:" + print_info " ✓ Docker containers and images" + print_info " ✓ Installation directory" + print_info " ✓ Global commands" + echo "" + print_info "Thank you for using LazyVim Docker! 🚀" + echo "" + print_info "To reinstall later, run:" + echo " ${GREEN}curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash${NC}" + echo "" +} + +# Run main function +main "$@" diff --git a/scripts/remote-update.sh b/scripts/remote-update.sh new file mode 100755 index 0000000..b0a259e --- /dev/null +++ b/scripts/remote-update.sh @@ -0,0 +1,225 @@ +#!/bin/bash + +# LazyVim Docker - Remote Update Script +# This script updates LazyVim Docker to the latest version + +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +# Configuration +REPO_URL="https://github.com/manghidev/lazyvim-docker" +INSTALL_DIR="$HOME/.local/share/lazyvim-docker" +TEMP_DIR="/tmp/lazyvim-docker-update" +BACKUP_DIR="$HOME/.local/share/lazyvim-docker-backup-$(date +%Y%m%d-%H%M%S)" + +# Print functions +print_header() { + echo -e "${CYAN}╔══════════════════════════════════════════════════════════════╗${NC}" + echo -e "${CYAN}║ LazyVim Docker - Updater ║${NC}" + echo -e "${CYAN}╚══════════════════════════════════════════════════════════════╝${NC}" + echo "" +} + +print_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +print_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +print_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +print_step() { + echo -e "${PURPLE}[STEP]${NC} $1" +} + +# Check if installation exists +check_installation() { + if [ ! -d "$INSTALL_DIR" ]; then + print_error "LazyVim Docker installation not found at: $INSTALL_DIR" + print_info "Please install first:" + echo " curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash" + exit 1 + fi +} + +# Get current version +get_current_version() { + if [ -f "$INSTALL_DIR/VERSION" ]; then + cat "$INSTALL_DIR/VERSION" + else + echo "unknown" + fi +} + +# Get latest version from GitHub +get_latest_version() { + if command -v curl >/dev/null 2>&1; then + curl -s "https://api.github.com/repos/manghidev/lazyvim-docker/releases/latest" | \ + grep '"tag_name":' | \ + sed -E 's/.*"([^"]+)".*/\1/' || echo "unknown" + else + echo "unknown" + fi +} + +# Backup current installation +backup_installation() { + print_step "Creating backup of current installation..." + + cp -r "$INSTALL_DIR" "$BACKUP_DIR" + print_success "Backup created at: $BACKUP_DIR" +} + +# Download latest version +download_latest() { + print_step "Downloading latest version..." + + # Remove temp directory if it exists + rm -rf "$TEMP_DIR" + + # Clone the repository to temp directory + if git clone --depth 1 "$REPO_URL" "$TEMP_DIR" >/dev/null 2>&1; then + print_success "Latest version downloaded" + else + print_error "Failed to download latest version" + exit 1 + fi +} + +# Update installation +update_installation() { + print_step "Updating installation..." + + # Stop containers first + cd "$INSTALL_DIR" + print_info "Stopping containers..." + make stop 2>/dev/null || true + + # Preserve user configurations + local preserve_dirs=("backups" ".dotfiles") + local temp_preserve="/tmp/lazyvim-preserve-$$" + mkdir -p "$temp_preserve" + + for dir in "${preserve_dirs[@]}"; do + if [ -d "$INSTALL_DIR/$dir" ]; then + cp -r "$INSTALL_DIR/$dir" "$temp_preserve/" + print_info "Preserved: $dir" + fi + done + + # Remove old installation (except preserved items) + find "$INSTALL_DIR" -mindepth 1 -maxdepth 1 ! -name "backups" ! -name ".dotfiles" -exec rm -rf {} + + + # Copy new files + cp -r "$TEMP_DIR"/* "$INSTALL_DIR/" + + # Restore preserved configurations + for dir in "${preserve_dirs[@]}"; do + if [ -d "$temp_preserve/$dir" ]; then + cp -r "$temp_preserve/$dir" "$INSTALL_DIR/" + fi + done + + # Cleanup temp preserve + rm -rf "$temp_preserve" + + # Make scripts executable + chmod +x "$INSTALL_DIR/scripts/"*.sh + chmod +x "$INSTALL_DIR/Makefile" + + print_success "Installation updated successfully" +} + +# Rebuild if needed +rebuild_containers() { + echo "" + echo -n "Do you want to rebuild Docker containers with the latest changes? [Y/n]: " + read -r response + + case "$response" in + [nN][oO]|[nN]) + print_info "Skipping container rebuild" + ;; + *) + print_step "Rebuilding Docker containers..." + cd "$INSTALL_DIR" + if make build; then + print_success "Containers rebuilt successfully" + else + print_warning "Container rebuild failed. You can try 'lazyvim build' later." + fi + ;; + esac +} + +# Cleanup +cleanup() { + print_step "Cleaning up temporary files..." + rm -rf "$TEMP_DIR" + print_success "Cleanup completed" +} + +# Main update process +main() { + print_header + + check_installation + + local current_version=$(get_current_version) + local latest_version=$(get_latest_version) + + print_info "Current version: $current_version" + print_info "Latest version: $latest_version" + echo "" + + if [ "$current_version" = "$latest_version" ] && [ "$current_version" != "unknown" ]; then + print_success "You already have the latest version!" + echo "" + echo -n "Do you want to force update anyway? [y/N]: " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + print_info "Proceeding with forced update..." + ;; + *) + print_info "Update cancelled" + exit 0 + ;; + esac + fi + + backup_installation + download_latest + update_installation + rebuild_containers + cleanup + + echo "" + print_success "🎉 LazyVim Docker updated successfully!" + echo "" + print_info "Updated to version: $(get_current_version)" + print_info "Backup available at: $BACKUP_DIR" + echo "" + print_info "To start using the updated version:" + echo " ${GREEN}lazyvim enter${NC}" + echo "" +} + +# Run main function +main "$@" diff --git a/scripts/uninstall-global-commands.sh b/scripts/uninstall-global-commands.sh index bfff05b..76fc43b 100755 --- a/scripts/uninstall-global-commands.sh +++ b/scripts/uninstall-global-commands.sh @@ -114,12 +114,12 @@ remove_project_directory() { print_status "Removing project directory: $project_dir" # Stop and remove containers first - if command -v docker-compose >/dev/null 2>&1 || command -v docker >/dev/null 2>&1; then + if command -v docker >/dev/null 2>&1; then print_status "Stopping and removing Docker containers..." cd "$project_dir" make destroy 2>/dev/null || { print_warning "Could not run 'make destroy'. Attempting manual cleanup..." - docker-compose down -v 2>/dev/null || docker compose down -v 2>/dev/null || true + docker compose down -v 2>/dev/null || true docker rmi lazyvim-docker_code-editor 2>/dev/null || true } fi From d7455fca1bcac95876fa0dc2b3c438bce162ccfb Mon Sep 17 00:00:00 2001 From: Ricardo <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:14:20 -0600 Subject: [PATCH 4/8] feat: add configuration script for reconfiguring directories and timezone, update related commands in Makefile and scripts --- .dockerignore | 1 + Makefile | 6 +- README.md | 105 +++++----- docker-compose.yml | 26 +-- docs/CHANGELOG.md | 65 ------ scripts/configure.sh | 310 +++++++++++++++++++++++++++++ scripts/install-global-commands.sh | 10 +- scripts/remote-install.sh | 164 ++++++++++++++- 8 files changed, 539 insertions(+), 148 deletions(-) create mode 100644 .dockerignore delete mode 100644 docs/CHANGELOG.md create mode 100755 scripts/configure.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/Makefile b/Makefile index 83c7b37..e77328c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # LazyVim Docker - Makefile # Provides easy-to-use commands for managing the LazyVim Docker environment -.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall remote-install remote-uninstall remote-update +.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall remote-install remote-uninstall remote-update configure configure # Default target .DEFAULT_GOAL := help @@ -183,3 +183,7 @@ test-remote-scripts: ## Test remote installation scripts locally @bash -n scripts/remote-uninstall.sh && echo "$(GREEN)✓ remote-uninstall.sh syntax OK$(NC)" @bash -n scripts/remote-update.sh && echo "$(GREEN)✓ remote-update.sh syntax OK$(NC)" @echo "$(GREEN)All remote scripts passed syntax check!$(NC)" + +configure: ## Reconfigure directories and timezone + @echo "$(BLUE)Reconfiguring LazyVim Docker environment...$(NC)" + @./scripts/configure.sh diff --git a/README.md b/README.md index 49fda4f..b631bff 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,6 @@ curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scrip |--------|---------|----------|---------------| | **Remote Install** | `curl ... \| bash` | End users, daily use | ✅ `lazy` anywhere | | **Traditional** | `git clone ...` | Developers, customization | ❌ Must `cd` to directory | -| **Quick Install** | `curl quick-install.sh` | Fast setup | ✅ `lazy` anywhere | ### Switching Between Methods @@ -268,11 +267,46 @@ For detailed workflow and troubleshooting: **[📖 Container Lifecycle Guide](do ## 🔧 Advanced Configuration -## 🔧 Advanced Configuration +## 🔧 Configuration + +### 🎯 Easy Configuration (Recommended) +After installation, you can easily reconfigure directories and timezone: -### Timezone Configuration +```bash +# Reconfigure interactively - works from anywhere +lazy configure + +# Traditional installation +make configure # (from project directory) +``` + +**What you can configure:** +- ✅ **Timezone**: Automatically detects your system timezone with common options +- ✅ **Directories**: Choose which local directories to mount in the container +- ✅ **Projects Folder**: Set up your main development directory +- ✅ **Custom Mounts**: Add any additional directories you need + +### 📁 Directory Configuration Examples + +**During `lazy configure` you can set up:** +```bash +# Common setups that will be offered +~/Documents → /home/developer/Documents # Default +~/Projects → /home/developer/Projects # Development projects +~/Developer → /home/developer/Developer # macOS default +~/Desktop → /home/developer/Desktop # Quick access files +/Volumes/USB → /home/developer/usb # External drives +``` + +### 🕒 Timezone Configuration Configure your timezone in `docker-compose.yml`: +**Automated (Easy):** +```bash +lazy configure # Interactive timezone selection +``` + +**Manual (Traditional):** ```yaml services: code-editor: @@ -283,15 +317,21 @@ services: - TZ=America/Mexico_City # And this ``` -**Common timezones:** Mexico_City, New_York, Los_Angeles, Madrid, London, Tokyo +**Common timezones:** +- `America/New_York` (EST/EDT) +- `America/Los_Angeles` (PST/PDT) +- `America/Mexico_City` (CST/CDT) +- `Europe/London` (GMT/BST) +- `Europe/Madrid` (CET/CEST) +- `Asia/Tokyo` (JST) **Apply changes:** ```bash -lazy build # Remote installation +lazy build # Remote installation make build # Traditional installation ``` -### Volume Mounting +### 📂 Advanced Volume Mounting Add your project directories in `docker-compose.yml`: ```yaml @@ -299,6 +339,7 @@ volumes: - $HOME/Documents:/home/developer/Documents # Default - $HOME/Projects:/home/developer/Projects # Add this - $HOME/Developer:/home/developer/Developer # Or this + - /path/to/custom:/home/developer/custom # Custom paths ``` --- @@ -329,16 +370,11 @@ lazy uninstall && curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim --- -## � Documentation & Support +## 📑 Documentation & Support **Main Documentation:** - **[📖 Complete Commands Reference](docs/COMMANDS.md)** - All available commands -- **[📝 Changelog](docs/CHANGELOG.md)** - Version history -- **[� Container Lifecycle Guide](docs/CONTAINER_LIFECYCLE.md)** - Detailed workflows - -**Quick Start:** -- Remote: `curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh | bash` -- Traditional: `git clone ... && make quick` +- **[🔁 Container Lifecycle Guide](docs/CONTAINER_LIFECYCLE.md)** - Detailed workflows **Support:** - 🐛 [Report Issues](https://github.com/manghidev/lazyvim-docker/issues) @@ -358,45 +394,4 @@ lazy uninstall && curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim **Additional Resources:** - [LazyVim Docs](https://lazyvim.github.io/) | [Neovim Docs](https://neovim.io/doc/) - [Docker Docs](https://docs.docker.com/) | [Oh My Zsh](https://ohmyz.sh/) - ---- - -## 📚 Quick Reference - -### 🚀 Remote Scripts Commands - -| Action | Command | Description | -|--------|---------|-------------| -| **Install** | `curl -fsSL https://raw.githubusercontent.com/manghidev/lazyvim-docker/main/scripts/remote-install.sh \| bash` | Complete setup | -| **Update** | `lazy update` | Update to latest version | -| **Uninstall** | `lazy uninstall` | Remove everything | - -### 💻 Daily Commands (After Remote Install) - -| Command | Description | Usage | -|---------|-------------|-------| -| `lazy enter` | Enter development environment | Daily coding | -| `lazy status` | Check container status | Debugging | -| `lazy start` | Start containers | If stopped | -| `lazy stop` | Stop containers | End of day | -| `lazy build` | Rebuild environment | After updates | -| `lazy help` | Show all commands | Reference | - -### 🛠️ Troubleshooting Commands - -```bash -# Check what's running -lazy status - -# Full restart -lazy stop && lazy start - -# Nuclear option - rebuild everything -lazy build - -# Update to latest version -lazy update - -# Complete removal -lazy uninstall -``` \ No newline at end of file +- [Powerlevel10k Theme](https://github.com/romkatv/powerlevel10k) | [Zsh Plugins](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6b6d545..1e8dd96 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,31 +22,18 @@ services: - npm-cache:/home/developer/.npm - pip-cache:/home/developer/.cache/pip - #* Mount directories based on your OS + #* Mount directories #* Uncomment and modify the appropriate lines below - #* Mount the user's Documents directory on macOS - - $HOME/Documents:/home/developer/Documents - - #* Mount the user's Documents directory on Linux + #* Mount the user's Documents directory # - $HOME/Documents:/home/developer/Documents - #* Mount the user's Desktop directory - # - $HOME/Desktop:/home/developer/Desktop - - #* Mount a development projects directory - # - $HOME/Projects:/home/developer/Projects - # - $HOME/Developer:/home/developer/Developer - #* Mount the user's USB on macOS # - /Volumes/USB_NAME:/home/developer/usb #* Mount the user's USB on Linux # - /media/$USER/USB_NAME:/home/developer/usb - #* Mount additional drives or directories - # - /path/to/your/custom/directory:/home/developer/custom - environment: - TERM=xterm-256color - COLORTERM=truecolor @@ -55,13 +42,8 @@ services: - TZ=America/Mexico_City stdin_open: true tty: true - # Uncomment for network access to specific ports - # ports: - # - "3000:3000" # For web development - # - "8080:8080" # For alternative web dev - # - "5173:5173" # For Vite dev server -# Named volumes for better performance and persistence +#* Named volumes for better performance and persistence volumes: nvim-cache: driver: local @@ -70,4 +52,4 @@ volumes: npm-cache: driver: local pip-cache: - driver: local \ No newline at end of file + driver: local diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md deleted file mode 100644 index 6e74266..0000000 --- a/docs/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [1.2.0] - 2025-06-27 - -### Added -- **Makefile** with intuitive commands for easy container management -- **Enhanced scripts** with error handling, logging, and validation -- **Health check script** (`scripts/health-check.sh`) for environment monitoring -- **Setup script** (`scripts/setup.sh`) for initial configuration -- **Version management script** (`scripts/bump-version.sh`) for semantic versioning -- **Development mode** with `docker-compose.dev.yml` for mounting workspace -- **Named volumes** for better performance (nvim-cache, zsh-cache, npm-cache, pip-cache) -- **Extended Dockerfile** with additional development tools: - - Python 3 with pip and development packages (black, flake8, mypy, pytest) - - Enhanced terminal tools (bat, exa, fd, tmux, htop, tree) - - Additional zsh plugins (syntax-highlighting, completions) - - Useful aliases and environment variables - - Network and build tools -- **Backup and restore functionality** for dotfiles -- **Environment configuration** with `.env.example` template -- **Improved .gitignore** with comprehensive exclusions -- **Enhanced documentation** with detailed setup and usage instructions - -### Changed -- **Improved `build.sh`** with better error handling and logging -- **Enhanced `init.sh`** with container status validation and auto-build option -- **Better `destroy.sh`** with confirmation prompts and cleanup -- **Updated `docker-compose.yml`** with: - - Named volumes for performance - - Better environment variables - - Container hostname and restart policy - - Improved volume mount structure -- **Comprehensive README** with: - - Quick start instructions - - Detailed command reference - - Troubleshooting guide - - Development tips - - Better organization and formatting - -### Fixed -- Container accessibility and health checking -- Permission issues with dotfiles -- Docker resource cleanup -- Script execution permissions - -## [1.1.0] - Previous Release - -### Added -- Basic LazyVim Docker environment -- Oh My Zsh with Powerlevel10k theme -- Essential development tools -- Volume mounting for Documents directory -- Basic build, init, and destroy scripts - -### Features -- LazyVim Neovim configuration -- Zsh with auto-suggestions -- Git and Lazygit integration -- FZF and Ripgrep for fast searching -- Persistent dotfiles configuration diff --git a/scripts/configure.sh b/scripts/configure.sh new file mode 100755 index 0000000..ac5a6b6 --- /dev/null +++ b/scripts/configure.sh @@ -0,0 +1,310 @@ +#!/bin/bash + +# LazyVim Docker - Configuration Script +# This script helps reconfigure directories and timezone + +set -e + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +CYAN='\033[0;36m' +NC='\033[0m' + +# Functions +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +print_header() { + echo -e "${CYAN}╔══════════════════════════════════════════════════════════════╗${NC}" + echo -e "${CYAN}║ LazyVim Docker - Configuration ║${NC}" + echo -e "${CYAN}║ Reconfigure Directories & Timezone ║${NC}" + echo -e "${CYAN}╚══════════════════════════════════════════════════════════════╝${NC}" + echo "" +} + +# Configure timezone +configure_timezone() { + log_info "Configuring timezone..." + + # Detect system timezone + local system_tz="" + if command -v timedatectl >/dev/null 2>&1; then + system_tz=$(timedatectl show --property=Timezone --value 2>/dev/null || echo "") + elif [[ -f /etc/timezone ]]; then + system_tz=$(cat /etc/timezone 2>/dev/null || echo "") + elif [[ "$OSTYPE" == "darwin"* ]]; then + system_tz=$(ls -la /etc/localtime 2>/dev/null | sed 's/.*zoneinfo\///' || echo "") + fi + + # Get current timezone from docker-compose.yml + local current_tz=$(grep "TIMEZONE:" docker-compose.yml | awk '{print $2}' || echo "") + + # Default timezone if detection fails + local default_tz="${system_tz:-${current_tz:-America/Mexico_City}}" + + echo "Current system timezone: ${system_tz:-"Could not detect"}" + echo "Current container timezone: ${current_tz:-"Not set"}" + echo "" + echo "Available timezone examples:" + echo " - America/New_York (EST/EDT)" + echo " - America/Los_Angeles (PST/PDT)" + echo " - America/Chicago (CST/CDT)" + echo " - America/Mexico_City (CST/CDT)" + echo " - Europe/London (GMT/BST)" + echo " - Europe/Madrid (CET/CEST)" + echo " - Europe/Paris (CET/CEST)" + echo " - Asia/Tokyo (JST)" + echo " - Asia/Shanghai (CST)" + echo "" + + read -p "Enter your timezone [$default_tz]: " user_tz + user_tz=${user_tz:-$default_tz} + + # Update timezone in docker-compose.yml + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "s/TIMEZONE: .*/TIMEZONE: $user_tz/" docker-compose.yml + sed -i '' "s/TZ=.*/TZ=$user_tz/" docker-compose.yml + else + sed -i "s/TIMEZONE: .*/TIMEZONE: $user_tz/" docker-compose.yml + sed -i "s/TZ=.*/TZ=$user_tz/" docker-compose.yml + fi + + log_success "Timezone configured: $user_tz" +} + +# Configure directories +configure_directories() { + log_info "Configuring directories to mount..." + + # Detect OS + local os_type="" + local default_docs="$HOME/Documents" + local default_projects="" + + if [[ "$OSTYPE" == "darwin"* ]]; then + os_type="macOS" + default_projects="$HOME/Developer" + else + os_type="Linux" + default_projects="$HOME/Projects" + fi + + echo "Detected OS: $os_type" + echo "The container will mount directories so you can access your files inside the development environment." + echo "" + + # Show current mounts + echo "Current volume mounts in docker-compose.yml:" + grep -E "^\s*-\s+.*:.*$" docker-compose.yml | grep -v "cache\|npm\|pip" | sed 's/^/ /' + echo "" + + # Configure Documents directory + echo "📁 Documents Directory:" + if [[ -d "$default_docs" ]]; then + read -p "Mount Documents directory ($default_docs)? (Y/n): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Nn]$ ]]; then + # Ensure Documents is enabled + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's|^ # - \$HOME/Documents:| - \$HOME/Documents:|' docker-compose.yml + else + sed -i 's|^ # - \$HOME/Documents:| - \$HOME/Documents:|' docker-compose.yml + fi + log_info "Documents directory will be mounted at /home/developer/Documents" + else + # Comment out the Documents line + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's|^ - \$HOME/Documents:| # - \$HOME/Documents:|' docker-compose.yml + else + sed -i 's|^ - \$HOME/Documents:| # - \$HOME/Documents:|' docker-compose.yml + fi + log_info "Documents directory mounting disabled" + fi + fi + + # Configure Projects directory + echo "" + echo "💻 Projects Directory:" + local has_projects=$(grep -c "Projects:/home/developer/Projects" docker-compose.yml || echo "0") + + if [[ $has_projects -gt 0 ]]; then + local current_projects=$(grep "Projects:/home/developer/Projects" docker-compose.yml | sed 's/.*- //' | sed 's/:.*//') + echo "Current Projects directory: $current_projects" + read -p "Keep current Projects directory? (Y/n): " -n 1 -r + echo + if [[ $REPLY =~ ^[Nn]$ ]]; then + # Remove current projects line + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' '/Projects:\/home\/developer\/Projects/d' docker-compose.yml + else + sed -i '/Projects:\/home\/developer\/Projects/d' docker-compose.yml + fi + has_projects=0 + fi + fi + + if [[ $has_projects -eq 0 ]]; then + read -p "Do you want to mount a Projects directory? (Y/n): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Nn]$ ]]; then + read -p "Enter path to your projects directory [$default_projects]: " projects_dir + projects_dir=${projects_dir:-$default_projects} + + if [[ -d "$projects_dir" ]]; then + # Add projects directory to docker-compose.yml after Documents line + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "/\$HOME\/Documents:/a\\ + - $projects_dir:/home/developer/Projects" docker-compose.yml + else + sed -i "/\$HOME\/Documents:/a\\ + - $projects_dir:/home/developer/Projects" docker-compose.yml + fi + log_success "Projects directory added: $projects_dir -> /home/developer/Projects" + else + log_warning "Directory $projects_dir does not exist, you can create it and rebuild later" + fi + fi + fi + + # Configure additional directories + echo "" + echo "📂 Additional Directories:" + read -p "Do you want to add/modify additional directories? (y/N): " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "" + echo "Options:" + echo " 1. Add a new directory" + echo " 2. Remove a directory mount" + echo " 3. Done" + echo "" + + while true; do + read -p "Select option (1-3): " -n 1 -r + echo + case $REPLY in + 1) + read -p "Enter directory path to mount: " custom_dir + if [[ -d "$custom_dir" ]]; then + local mount_name=$(basename "$custom_dir") + read -p "Mount as [/home/developer/$mount_name]: " container_path + container_path=${container_path:-"/home/developer/$mount_name"} + + # Add custom directory to docker-compose.yml + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "/\$HOME\/Documents:/a\\ + - $custom_dir:$container_path" docker-compose.yml + else + sed -i "/\$HOME\/Documents:/a\\ + - $custom_dir:$container_path" docker-compose.yml + fi + log_success "Added: $custom_dir -> $container_path" + else + log_warning "Directory $custom_dir does not exist" + fi + ;; + 2) + echo "Current custom mounts (excluding system directories):" + grep -E "^\s*-\s+.*:.*$" docker-compose.yml | grep -v -E "(cache|npm|pip|Documents|\.dotfiles)" | nl + read -p "Enter line number to remove (or 'cancel'): " line_num + if [[ "$line_num" =~ ^[0-9]+$ ]]; then + # This is complex, let's just show instructions + log_info "Please manually edit docker-compose.yml to remove unwanted mounts" + fi + ;; + 3) + break + ;; + *) + echo "Invalid option. Please select 1, 2, or 3." + ;; + esac + echo "" + done + fi + + log_success "Directory configuration completed" +} + +# Main function +main() { + print_header + + # Check if we're in the right directory + if [[ ! -f "docker-compose.yml" ]]; then + log_error "This script must be run from the lazyvim-docker directory" + echo "If you installed remotely, use: lazy configure" + exit 1 + fi + + log_info "This will help you reconfigure your LazyVim Docker environment." + echo "" + + # Show current configuration + local current_tz=$(grep "TIMEZONE:" docker-compose.yml | awk '{print $2}' || echo "Not set") + echo "Current Configuration:" + echo " Timezone: $current_tz" + echo " Container: $(docker ps -q -f name=lazyvim >/dev/null 2>&1 && echo "Running" || echo "Stopped")" + echo "" + + # Ask what to configure + echo "What would you like to configure?" + echo " 1. Timezone only" + echo " 2. Directory mounts only" + echo " 3. Both timezone and directories" + echo " 4. Exit" + echo "" + + read -p "Select option (1-4): " -n 1 -r + echo + case $REPLY in + 1) + configure_timezone + ;; + 2) + configure_directories + ;; + 3) + configure_timezone + echo "" + configure_directories + ;; + 4) + log_info "Configuration cancelled" + exit 0 + ;; + *) + log_error "Invalid option selected" + exit 1 + ;; + esac + + echo "" + log_success "Configuration completed!" + echo "" + echo "Next steps:" + echo " 1. Rebuild container: make build" + echo " 2. Or restart if already built: make restart" + echo " 3. Enter container: make enter" + echo "" + echo "Changes will take effect after rebuilding/restarting the container." +} + +# Run main function +main "$@" diff --git a/scripts/install-global-commands.sh b/scripts/install-global-commands.sh index 630de89..933bad9 100755 --- a/scripts/install-global-commands.sh +++ b/scripts/install-global-commands.sh @@ -109,7 +109,7 @@ lazy() { shift case "\$cmd" in - help|start|enter|stop|status|health|build|restart|destroy|clean|quick|logs|backup|version) + help|start|enter|stop|status|health|build|restart|destroy|clean|quick|logs|backup|configure|version) echo "🚀 Running: make \$cmd \$@" (cd "\$lazyvim_docker_path" && make "\$cmd" "\$@") ;; @@ -127,7 +127,7 @@ lazy() { # Tab completion for lazy command _lazy_completion() { - local commands=(help start enter stop status health build restart destroy clean quick logs backup version uninstall) + local commands=(help start enter stop status health build restart destroy clean quick logs backup configure version uninstall) _describe 'commands' commands } @@ -182,6 +182,7 @@ lazy() { echo " quick Quick start (build + enter)" echo " logs Show container logs" echo " backup Backup configurations" + echo " configure Reconfigure directories and timezone" echo " version Show version" echo " uninstall Remove global commands" echo "" @@ -189,6 +190,7 @@ lazy() { echo " lazy enter # Enter LazyVim from anywhere" echo " lazy status # Check container status" echo " lazy health # Run full diagnostics" + echo " lazy configure # Reconfigure directories and timezone" echo " lazy uninstall # Remove global commands" echo "" return 0 @@ -198,7 +200,7 @@ lazy() { shift case "\$cmd" in - help|start|enter|stop|status|health|build|restart|destroy|clean|quick|logs|backup|version) + help|start|enter|stop|status|health|build|restart|destroy|clean|quick|logs|backup|configure|version) echo "🚀 Running: make \$cmd \$@" (cd "\$lazyvim_docker_path" && make "\$cmd" "\$@") ;; @@ -217,7 +219,7 @@ lazy() { # Tab completion for lazy command (basic) _lazy_completion() { local cur="\${COMP_WORDS[COMP_CWORD]}" - local commands="help start enter stop status health build restart destroy clean quick logs backup version uninstall" + local commands="help start enter stop status health build restart destroy clean quick logs backup configure version uninstall" COMPREPLY=(\$(compgen -W "\$commands" -- "\$cur")) } diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh index 61d4531..d0d4600 100755 --- a/scripts/remote-install.sh +++ b/scripts/remote-install.sh @@ -225,18 +225,176 @@ add_to_path() { fi } +# Configure timezone +configure_timezone() { + print_step "Configuring timezone..." + + # Detect system timezone + local system_tz="" + if command -v timedatectl >/dev/null 2>&1; then + system_tz=$(timedatectl show --property=Timezone --value 2>/dev/null || echo "") + elif [[ -f /etc/timezone ]]; then + system_tz=$(cat /etc/timezone 2>/dev/null || echo "") + elif [[ "$OSTYPE" == "darwin"* ]]; then + system_tz=$(ls -la /etc/localtime 2>/dev/null | sed 's/.*zoneinfo\///' || echo "") + fi + + # Default timezone if detection fails + local default_tz="${system_tz:-America/Mexico_City}" + + echo "Current system timezone detected: ${system_tz:-"Could not detect"}" + echo "Available timezone examples:" + echo " - America/New_York" + echo " - America/Los_Angeles" + echo " - America/Mexico_City" + echo " - Europe/London" + echo " - Europe/Madrid" + echo " - Asia/Tokyo" + echo "" + + read -p "Enter your timezone [$default_tz]: " user_tz + user_tz=${user_tz:-$default_tz} + + # Update timezone in docker-compose.yml + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "s/TIMEZONE: .*/TIMEZONE: $user_tz/" docker-compose.yml + sed -i '' "s/TZ=.*/TZ=$user_tz/" docker-compose.yml + else + sed -i "s/TIMEZONE: .*/TIMEZONE: $user_tz/" docker-compose.yml + sed -i "s/TZ=.*/TZ=$user_tz/" docker-compose.yml + fi + + print_success "Timezone configured: $user_tz" +} + +# Configure directories +configure_directories() { + print_step "Configuring directories to mount..." + + # Detect OS + local os_type="" + local default_docs="$HOME/Documents" + local default_projects="" + + if [[ "$OSTYPE" == "darwin"* ]]; then + os_type="macOS" + default_projects="$HOME/Developer" + else + os_type="Linux" + default_projects="$HOME/Projects" + fi + + echo "Detected OS: $os_type" + echo "The container will mount directories so you can access your files inside the development environment." + echo "" + + # Configure Documents directory + echo "📁 Documents Directory:" + if [[ -d "$default_docs" ]]; then + read -p "Mount Documents directory ($default_docs)? (Y/n): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Nn]$ ]]; then + print_info "Documents directory will be mounted at /home/developer/Documents" + else + # Comment out the Documents line + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's|^ - \$HOME/Documents:| # - \$HOME/Documents:|' docker-compose.yml + else + sed -i 's|^ - \$HOME/Documents:| # - \$HOME/Documents:|' docker-compose.yml + fi + print_info "Documents directory mounting disabled" + fi + fi + + # Configure Projects directory + echo "" + echo "💻 Projects Directory:" + read -p "Do you want to mount a Projects directory? (Y/n): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Nn]$ ]]; then + read -p "Enter path to your projects directory [$default_projects]: " projects_dir + projects_dir=${projects_dir:-$default_projects} + + if [[ -d "$projects_dir" ]]; then + # Add projects directory to docker-compose.yml + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "/\$HOME\/Documents:/a\\ + - $projects_dir:/home/developer/Projects" docker-compose.yml + else + sed -i "/\$HOME\/Documents:/a\\ + - $projects_dir:/home/developer/Projects" docker-compose.yml + fi + print_success "Projects directory added: $projects_dir -> /home/developer/Projects" + else + print_warning "Directory $projects_dir does not exist, you can add it later" + fi + fi + + # Configure additional directories + echo "" + echo "📂 Additional Directories:" + read -p "Do you want to mount any additional directories? (y/N): " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + local counter=1 + while true; do + echo "" + read -p "Enter directory path (or 'done' to finish): " custom_dir + if [[ "$custom_dir" == "done" ]]; then + break + fi + + if [[ -d "$custom_dir" ]]; then + local mount_name=$(basename "$custom_dir") + read -p "Mount as [/home/developer/$mount_name]: " container_path + container_path=${container_path:-"/home/developer/$mount_name"} + + # Add custom directory to docker-compose.yml + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "/\$HOME\/Documents:/a\\ + - $custom_dir:$container_path" docker-compose.yml + else + sed -i "/\$HOME\/Documents:/a\\ + - $custom_dir:$container_path" docker-compose.yml + fi + print_success "Added: $custom_dir -> $container_path" + else + print_warning "Directory $custom_dir does not exist, skipping" + fi + + counter=$((counter + 1)) + if [[ $counter -gt 5 ]]; then + print_info "Maximum directories reached" + break + fi + done + fi + + print_success "Directory configuration completed" +} + # Initial setup initial_setup() { print_step "Running initial setup..." cd "$INSTALL_DIR" + echo "" + print_info "Let's configure your LazyVim Docker environment..." + echo "" + + # Ask for configuration + configure_timezone + echo "" + configure_directories + echo "" + # Build the Docker environment print_info "Building Docker environment (this may take a few minutes)..." if make build; then print_success "Docker environment built successfully" else - print_warning "Docker build failed, but installation completed. You can run 'lazyvim build' later." + print_warning "Docker build failed, but installation completed. You can run 'lazy build' later." fi } @@ -272,6 +430,7 @@ main() { echo " ${GREEN}lazy start${NC} # Start the container" echo " ${GREEN}lazy stop${NC} # Stop the container" echo " ${GREEN}lazy status${NC} # Check container status" + echo " ${GREEN}lazy configure${NC} # Reconfigure directories and timezone" echo " ${GREEN}lazy update${NC} # Update to latest version" echo " ${GREEN}lazy uninstall${NC} # Uninstall everything" echo " ${GREEN}lazy help${NC} # Show all available commands" @@ -280,6 +439,9 @@ main() { echo " 1. Restart your terminal or run: ${YELLOW}source ~/.zshrc${NC} (or ~/.bashrc)" echo " 2. Run: ${GREEN}lazy enter${NC}" echo "" + print_info "To reconfigure directories or timezone later:" + echo " Run: ${GREEN}lazy configure${NC}" + echo "" print_info "Happy coding! 🚀" } From de51732663ba83b1b146f99264ba1eaa33b38d5f Mon Sep 17 00:00:00 2001 From: Ricardo <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:38:11 -0600 Subject: [PATCH 5/8] feat: add configure command to reconfigure directories and timezone --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index e77328c..0ab9bfe 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,10 @@ clean: ## Clean up unused Docker resources @docker volume prune -f @echo "$(GREEN)Cleanup completed$(NC)" +configure: ## Reconfigure directories and timezone + @echo "$(BLUE)Reconfiguring LazyVim Docker environment...$(NC)" + @./scripts/configure.sh + health: ## Run comprehensive health diagnostics @echo "$(BLUE)Running LazyVim environment health check...$(NC)" @./scripts/health-check.sh @@ -159,11 +163,11 @@ install-global: ## Install global 'lazy' commands to use from anywhere @echo "$(BLUE)Installing LazyVim Docker global commands...$(NC)" @./scripts/install-global-commands.sh -uninstall: ## Uninstall LazyVim Docker and remove global commands +uninstall: @echo "$(BLUE)Uninstalling LazyVim Docker...$(NC)" @./scripts/uninstall-global-commands.sh -install-remote: ## Show remote installation command +install-remote: @echo "$(BLUE)LazyVim Docker - Remote Installation$(NC)" @echo "" @echo "To install LazyVim Docker remotely (recommended):" @@ -175,15 +179,11 @@ install-remote: ## Show remote installation command @echo " • Build Docker environment" @echo " • No repository cloning required - everything is automated" -remote-install: install-remote ## Alias for install-remote +remote-install: install-remote -test-remote-scripts: ## Test remote installation scripts locally +test-remote-scripts: @echo "$(BLUE)Testing remote installation scripts...$(NC)" @bash -n scripts/remote-install.sh && echo "$(GREEN)✓ remote-install.sh syntax OK$(NC)" @bash -n scripts/remote-uninstall.sh && echo "$(GREEN)✓ remote-uninstall.sh syntax OK$(NC)" @bash -n scripts/remote-update.sh && echo "$(GREEN)✓ remote-update.sh syntax OK$(NC)" @echo "$(GREEN)All remote scripts passed syntax check!$(NC)" - -configure: ## Reconfigure directories and timezone - @echo "$(BLUE)Reconfiguring LazyVim Docker environment...$(NC)" - @./scripts/configure.sh From 205d1f3d6740017e4a12dcf2add787db9fc20b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20=F0=9F=87=B2=F0=9F=87=BD?= <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:46:08 -0600 Subject: [PATCH 6/8] Update Makefile Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0ab9bfe..ccb9401 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # LazyVim Docker - Makefile # Provides easy-to-use commands for managing the LazyVim Docker environment -.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall remote-install remote-uninstall remote-update configure configure +.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall install-remote remote-uninstall remote-update configure # Default target .DEFAULT_GOAL := help From df83184128c074b57126ea7367fcb39c48927e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20=F0=9F=87=B2=F0=9F=87=BD?= <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:46:38 -0600 Subject: [PATCH 7/8] Update scripts/uninstall-global-commands.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- scripts/uninstall-global-commands.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/uninstall-global-commands.sh b/scripts/uninstall-global-commands.sh index 76fc43b..2eca576 100755 --- a/scripts/uninstall-global-commands.sh +++ b/scripts/uninstall-global-commands.sh @@ -53,8 +53,9 @@ remove_from_config() { print_status "Removing LazyVim Docker commands from $config_file..." # Create a backup - cp "$config_file" "${config_file}.bak.$(date +%Y%m%d-%H%M%S)" - print_status "Backup created: ${config_file}.bak.$(date +%Y%m%d-%H%M%S)" + local timestamp="$(date +%Y%m%d-%H%M%S)" + cp "$config_file" "${config_file}.bak.$timestamp" + print_status "Backup created: ${config_file}.bak.$timestamp" # Remove the section between markers (including the markers) if sed -i.tmp "/$START_MARKER/,/$END_MARKER/d" "$config_file" 2>/dev/null; then From e971e9f04c526ff6273323311533edc6ae3d1dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20=F0=9F=87=B2=F0=9F=87=BD?= <31641216+manghidev@users.noreply.github.com> Date: Mon, 30 Jun 2025 23:08:19 -0600 Subject: [PATCH 8/8] Update Makefile Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ccb9401..df259c5 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ # LazyVim Docker - Makefile # Provides easy-to-use commands for managing the LazyVim Docker environment -.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart install-global uninstall install-remote remote-uninstall remote-update configure +.PHONY: help build start enter stop destroy clean status update logs backup restore dev quick version bump-version restart +.PHONY: install-global uninstall install-remote remote-uninstall remote-update configure # Default target .DEFAULT_GOAL := help