|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Script to set up local development environment for the website |
| 4 | + |
| 5 | +# Colors for output |
| 6 | +GREEN='\033[0;32m' |
| 7 | +YELLOW='\033[1;33m' |
| 8 | +RED='\033[0;31m' |
| 9 | +NC='\033[0m' # No Color |
| 10 | + |
| 11 | +echo -e "${YELLOW}Setting up local development environment...${NC}" |
| 12 | + |
| 13 | +# Add Homebrew Ruby to PATH |
| 14 | +echo -e "${YELLOW}Adding Homebrew Ruby to PATH...${NC}" |
| 15 | +export PATH="/opt/homebrew/opt/ruby/bin:$PATH" |
| 16 | + |
| 17 | +# Check Ruby version |
| 18 | +echo -e "${YELLOW}Checking Ruby version...${NC}" |
| 19 | +ruby_version=$(ruby -v) |
| 20 | +echo -e "Ruby version: ${GREEN}$ruby_version${NC}" |
| 21 | + |
| 22 | +# Check if Ruby is from Homebrew |
| 23 | +which_ruby=$(which ruby) |
| 24 | +if [[ $which_ruby == *"/opt/homebrew/opt/ruby/bin/ruby"* ]]; then |
| 25 | + echo -e "${GREEN}Using Homebrew Ruby: $which_ruby${NC}" |
| 26 | +else |
| 27 | + echo -e "${RED}Not using Homebrew Ruby. Current Ruby: $which_ruby${NC}" |
| 28 | + echo -e "${YELLOW}Please make sure Homebrew Ruby is installed:${NC}" |
| 29 | + echo -e " brew install ruby" |
| 30 | + echo -e "${YELLOW}Then add the following to your shell profile (.zshrc, .bash_profile, etc.):${NC}" |
| 31 | + echo -e " export PATH=\"/opt/homebrew/opt/ruby/bin:\$PATH\"" |
| 32 | + exit 1 |
| 33 | +fi |
| 34 | + |
| 35 | +# Update RubyGems |
| 36 | +echo -e "${YELLOW}Updating RubyGems...${NC}" |
| 37 | +gem update --system |
| 38 | + |
| 39 | +# Install Bundler |
| 40 | +echo -e "${YELLOW}Installing latest Bundler...${NC}" |
| 41 | +gem install bundler |
| 42 | + |
| 43 | +# Install dependencies |
| 44 | +echo -e "${YELLOW}Installing dependencies...${NC}" |
| 45 | +cd www |
| 46 | +bundle update --bundler |
| 47 | +bundle install |
| 48 | + |
| 49 | +echo -e "\n${GREEN}Setup complete!${NC}" |
| 50 | +echo -e "${YELLOW}To run the site locally:${NC}" |
| 51 | +echo -e " cd www" |
| 52 | +echo -e " bundle exec jekyll serve" |
| 53 | + |
| 54 | +echo -e "\n${YELLOW}To make this setup permanent, add the following to your shell profile (.zshrc, .bash_profile, etc.):${NC}" |
| 55 | +echo -e " export PATH=\"/opt/homebrew/opt/ruby/bin:\$PATH\"" |
| 56 | + |
| 57 | +echo -e "\n${GREEN}Done!${NC}" |
0 commit comments