Skip to content

Instantly share code, notes, and snippets.

@mshavliuk
Last active November 17, 2019 21:56
Show Gist options
  • Save mshavliuk/c8814e4d76fb7b4cb5878bfa5d5c8e45 to your computer and use it in GitHub Desktop.
Save mshavliuk/c8814e4d76fb7b4cb5878bfa5d5c8e45 to your computer and use it in GitHub Desktop.
This script will help you initialized workplace just at once
#!/usr/bin/env bash
# you can run this script with -y option to install all optional packages automatically
while getopts ":y" opt; do
case $opt in
y)
echo "-y was triggered, will install all optional packages"
YES=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
if ! [ -x "$(command -v brew)" ]; then
echo "brew not found. Install brew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew update
brew upgrade
sh=$(ps -p $(ps -p $$ -o ppid=) -o comm=)
if [[ $sh == *'zsh' ]]
then
>> ~/.zprofile
elif [[ $sh == *'bash' ]]
then
>> ~/.bash_profile
else
echo 'Your shell is not supported by this script'
exit
fi
echo "Install runtime dependencies..."
# https://www.python.org/ - backend runtime
brew install python
# https://git-scm.com/ - version control system
brew install git
# https://redis.io/ - in memory db
brew install redis@5.0
# https://www.postgresql.org/ - database
brew install postgresql@11
# https://github.com/Schniz/fnm - is a node version manager
brew install Schniz/tap/fnm
# https://yvm.js.org/docs/overview - yarn version manager
brew install tophat/bar/yvm
node "/usr/local/opt/yvm/yvm.js" configure-shell --yvmDir "/usr/local/opt/yvm"
# https://direnv.net/ - environment variables tool
brew install direnv
if [[ $sh == *'zsh' ]]
then
echo 'eval "$(direnv hook zsh)"' >> ~/.zprofile
elif [[ $sh == *'bash' ]]
then
echo 'eval "$(direnv hook bash)"' >> ~/.bash_profile
fi
# https://pypi.org/project/pip/ - package installer for Python
sudo easy_install pip
echo "Install runtime dependencies completed!"
echo "Install programs..."
function ask_and_install {
COMMAND="brew cask install $1"
if [[ $YES ]]
then
echo -e "\n$COMMAND"
$COMMAND
return 0
fi
read -p "do you want to install $1? [yY] " -n 1 -r
echo ''
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "\n$COMMAND"
$COMMAND
return 0
fi
}
# https://www.jetbrains.com/pycharm/ - fullstack IDE
ask_and_install pycharm
# https://www.jetbrains.com/webstorm/ - frontend IDE
ask_and_install webstorm
# https://www.sublimetext.com/ - lightweight IDE
ask_and_install sublime-text
# https://code.visualstudio.com/ - frontend IDE
ask_and_install visual-studio-code
# https://1password.com/ - password manager
ask_and_install 1password
# https://telegram.org/ - messenger
ask_and_install telegram
# https://www.google.com/chrome/ - web browser
ask_and_install google-chrome
echo "Install programs completed!"
brew cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment