Last active
January 26, 2024 20:23
-
-
Save mvogelgesang/099282f155b5b5d90576c75fd7bbe4d3 to your computer and use it in GitHub Desktop.
a shell script to install a local development environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#### INSTRUCTIONS #### | |
# Copy this file to a local directory | |
# Open terminal in directory containing this file | |
# change permissions of file to allow execution: chmod 700 newLaptopInstall.sh | |
# run: ./newLaptopInstall.sh | |
# You will be asked if you want to run in dry-run mode, I suggest doing this first | |
# and you can selectively comment out applications that you do not need. | |
#### END INSTRUCTIONS #### | |
# because everyone likes colors | |
cWhite='\033[0;37m' | |
cBlue='\033[0;34m' | |
cCyan='\033[0;36m' | |
cLightCyan='\033[0;96m' | |
cLightBlue='\033[0;94m' | |
cGreen='\033[0;32m' | |
cYellow='\033[0;33m' | |
cMagenta='\033[0;35m' | |
bBlue='\033[0;44m' | |
bCyan='\033[0;46m' | |
bLightBlue='\033[0;104m' | |
bLightCyan='\033[0;106m' | |
cNoColor='\033[0;0m' | |
arrow=" -> " | |
dryRun="Y" | |
# $1 text | |
# $2 start color | |
# $3 end color | |
wrapColors() { | |
echo -e $2 "$1" $cNoColor | |
} | |
# $1 - plaintext name | |
# $2 - install command | |
# $3 - extra indent | |
runCommand() { | |
indent="" | |
# add extra indent if arg3 == Y | |
if [ "$3" == "Y" ]; then | |
indent=" " | |
fi | |
echo -ne "${arrow}$1" | |
if [ "$dryRun" != "Y" ] && [ "$dryRun" != "y" ]; | |
then | |
eval $2 | |
else | |
sleep 0.3 | |
fi | |
echo -e "\r${arrow}${cGreen}$1${cNoColor}" | |
} | |
wrapColors " " $cLightBlue | |
wrapColors " ____ _____ __ __ ____ _ ____ ______ _____ ___ ____ ___ ___ " $cLightBlue | |
wrapColors " | / ___/| | | | \| | / || || | / \ | \ | | | " $cBlue | |
wrapColors " | ( \_ | | | | o ) | | o || || __|| || D )| _ _ | " $cBlue | |
wrapColors " | |\__ || | | | _/| |___ | ||_| |_|| |_ | O || / | \_/ | " $cCyan | |
wrapColors " | |/ \ || : | | | | || _ | | | | _] | || \ | | | " $cCyan | |
wrapColors " | |\ | \ / | | | || | | | | | | | || . \| | | " $cLightCyan | |
wrapColors " |____|\___| \_/ |__| |_____||__|__| |__| |__| \___/ |__|\_||___|___| " $cLightCyan | |
wrapColors " " | |
wrapColors " " $bLightCyan | |
wrapColors " ______ ____ ___ ___ ____ ____ ___ ____ ___ " $bLightCyan | |
wrapColors " | | / || | | / || \ | \ | \ / _] " $bLightCyan | |
wrapColors " | || o || _ _ | | o || _ || \ | o ) [_ " $bCyan | |
wrapColors " |_| |_|| || \_/ | | || | || D | | _/ _] " $bCyan | |
wrapColors " | | | _ || | | | _ || | || | | | | [_ " $bCyan | |
wrapColors " | | | | || | | | | || | || | | | | | " $bLightBlue | |
wrapColors " |__| |__|__||___|___| |__|__||__|__||_____| |__| |_____| " $bLightBlue | |
wrapColors " " $bLightBlue | |
echo "" | |
echo "Do you want to run in dry-run mode? [Y/N]" | |
read mode | |
dryRun=$mode | |
echo "" | |
if [ "$dryRun" == "Y" ] || [ "$dryRun" == "y" ]; | |
then | |
echo "Dry Run, no apps installed..." | |
else | |
echo "~~~~~~~~~~Installing...~~~~~~~~~~" | |
fi | |
echo "" | |
echo "Package Manager" | |
runCommand "Homebrew" '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' | |
# LANGUAGES | |
echo "" | |
echo "Languages and Version Managers" | |
runCommand "Node" "brew install node -q" | |
runCommand "Node Version Manager (NVM)" "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash" | |
# Install Ruby | |
# An up to date Ruby installation enables you to contribute to Jekyll-based documentation | |
# sites such as https://developer.salesforce.com/tools/vscode/en/apex/writing. | |
# These instructions came from https://snyk.io/blog/how-to-install-ruby-in-mac-os/ | |
runCommand "Ruby" "brew install rbenv ruby-build" | |
runCommand "Ruby Zsh" "$(rbenv init - zsh)" | |
runCommand "Reload .zshrc" "source ~/.zshrc" | |
runCommand "Ruby v2.7.8" "rbenv install 2.7.8" | |
# Install OpenJDK | |
# This is needed for the Salesforce Extension Pack and the Apex Replay Debugger (instructions) | |
runCommand "OpenJDK v17" "brew install openjdk@17" | |
echo "" | |
echo "Add JDK to PATH" | |
echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc | |
runCommand "Reload .zshrc" "source ~/.zshrc" | |
echo "" | |
echo "Development Tools" | |
runCommand "Git" "brew install git -q" | |
runCommand "GitHub CLI" "brew install gh -q" | |
runCommand "Postman" "brew install --cask postman -q" | |
runCommand "Altair GraphQL Client" "brew install --cask altair-graphql-client -q" | |
runCommand "Wireshark" "brew install wireshark -q" | |
runCommand "Ant" "brew install ant -q" | |
runCommand "Soap UI" "brew install --cask soapui -q" | |
runCommand "Visual Studio Code" "brew install —-cask visual-studio-code -q" | |
runCommand "Bun" "curl -fsSL https://bun.sh/install | bash" | |
runCommand "Heroku" "brew install heroku -q" | |
runCommand "wget" "brew install wget -q" | |
echo "" | |
echo "Other Productivity Tools" | |
runCommand "Firefox" "brew install --cask firefox -q" | |
runCommand "Pencil" "brew install --cask pencil -q" | |
runCommand "Quip Desktop" "brew install --cask quip -q" | |
runCommand "Arc Browser" "brew install --cask arc -q" | |
echo "" | |
echo "VS Code Extensions" | |
vscodeExtensions=' | |
DavidAnson.vscode-markdownlint | |
donjayamanne.githistory | |
eamodio.gitlens | |
salesforce.salesforcedx-vscode-expanded | |
stkb.rewrap | |
yzhang.markdown-all-in-one | |
' | |
for i in $vscodeExtensions | |
do | |
runCommand "${i}" "code --install-extension ${i}" "Y" | |
done | |
runCommand "Oh-My-Zsh Terminal" 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' | |
runCommand "PowerLevel10k Terminal Theme" "brew install powerlevel10k -q" | |
echo "source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrcecho "" | |
echo "" | |
echo "NPM Packages (Global)" | |
# Global NPM Packages | |
# Install SFDX & SF CLI’s | |
# https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm#sfdx_setup_install_cli_npm) | |
npmPackages=' | |
@salesforce/cli | |
typescript | |
prettier | |
yarn | |
' | |
for i in $npmPackages | |
do | |
runCommand "${i}" "npm install ${i} -g" "Y" | |
done | |
echo "" | |
echo "Configure Git" | |
echo -e "${cYellow}Enter your Salesforce email address (to skip this step, leave blank)${cNoColor}" | |
read workEmail | |
if [ "$workEmail" != "" ]; | |
then | |
runCommand "Creating SSH key" 'ssh-keygen -t ed25519 -C "$workEmail"' | |
runCommand "Adding SSH key to SSH Agent" "$(ssh-agent -s)" | |
else | |
echo " skipping Git configuration" | |
fi | |
echo "" | |
echo "Final Setup......" | |
runCommand "Enable auto completion for SF CLI" "sf autocomplete" "Y" | |
echo -e "${cLightBlue} | |
----------------------------------------------------------- | |
* * | |
* Next Steps * | |
* * | |
-----------------------------------------------------------${cNoColor}" | |
echo -e "${cMagenta}[ ]${cNoColor} ZSH offers auto completions, check it out at https://github.com/marlonrichert/zsh-autocomplete" | |
echo -e "${cMagenta}[ ]${cNoColor} GitHub CLI offers auto completions, check it out at https://cli.github.com/manual/gh_completion" | |
echo -e "${cMagenta}[ ]${cNoColor} Customize your ZSH terminal with themes, https://github.com/ohmyzsh/ohmyzsh/wiki/Themes" | |
echo -e "${cMagenta}[ ]${cNoColor} Make this script better by submitting a pull request at " | |
echo -e "${cMagenta}[ ]${cNoColor} You may need to symlink your Open JDK install. https://stackoverflow.com/questions/69875335/macos-how-to-install-java-17" | |
# Terminal | |
# Zsh Autocomplete, https://github.com/marlonrichert/zsh-autocomplete | |
# Run sf autocomplete and perform setup steps | |
# Run GH Autocomplete | |
# gh completion -s zsh > /usr/local/share/zsh/site-functions/_gh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment