-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup_dev_env.sh
executable file
·76 lines (62 loc) · 2.15 KB
/
setup_dev_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Function to check if Homebrew is installed
install_homebrew() {
if ! command -v brew &> /dev/null
then
echo "Homebrew not found, installing now..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Homebrew is already installed."
fi
}
# Function to download Brewfile and run brew bundle
setup_environment() {
echo "Downloading AJ's Awesome Brewfile..."
curl -O https://raw.githubusercontent.com/AnjanJ/my-mac-settings/main/Brewfile
echo "Running brew bundle to install software..."
brew bundle --file=Brewfile
}
# Function to install latest Ruby using rbenv
install_latest_ruby() {
echo "Installing the latest Ruby version using rbenv..."
rbenv install $(rbenv install -l | grep -v - | tail -1)
rbenv global $(rbenv install -l | grep -v - | tail -1)
echo "Installing latest version of Rails..."
gem install rails
rbenv rehash
}
# Function to install latest stable Node.js version using nodenv
install_latest_node() {
echo "Installing the latest stable Node.js version using nodenv..."
# Filter for stable versions and install the latest one
nodenv install $(nodenv install -l | grep -v - | grep -E '^[0-9.]+$' | tail -1)
nodenv global $(nodenv install -l | grep -v - | grep -E '^[0-9.]+$' | tail -1)
echo "Installing Yarn..."
npm install --global yarn
}
# function to copy .fig-export directory
copy_fig_export() {
echo "Copying fig dir to ~/fig-export"
# Ensure script has execution permissions
echo "Giving the script required permissions"
chmod +x copy_fig_export.sh
# Execute the script
echo "Executing the script"
./copy_fig_export.sh
}
# Function to copy .zshrc to the home directory
copy_zshrc() {
echo "Backing up existing .zshrc to .zshrc.backup..."
cp ~/.zshrc ~/.zshrc.backup
echo "Copying new .zshrc to the home directory..."
cp .zshrc ~/
echo ".zshrc copied successfully."
}
# Main Script Execution
install_homebrew
setup_environment
install_latest_ruby
install_latest_node
copy_fig_export
copy_zshrc
echo "Development environment setup complete."