Last active
September 26, 2019 06:00
-
-
Save Apexal/d6b2c257a927ac2d3db61ec6980d198b to your computer and use it in GitHub Desktop.
Run this to get started developing LATE!
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 | |
unameOut="$(uname -s)" | |
case "${unameOut}" in | |
Linux*) PLATFORM=Linux;; | |
Darwin*) PLATFORM=Mac;; | |
CYGWIN*) PLATFORM=Cygwin;; | |
MINGW*) PLATFORM=MinGw;; | |
*) PLATFORM="UNKNOWN:${unameOut}" | |
esac | |
if grep -q Microsoft /proc/version; then | |
PLATFORM="WSL" | |
fi | |
function change_directory { | |
echo Platform detected: $PLATFORM! Please let Frank know if this is wrong. | |
echo | |
if [ $PLATFORM == "WSL" ]; then | |
USER_NAME=`cmd.exe /c 'echo %USERNAME%' | sed -e 's/\r//g'` | |
INSTALL_PATH=/mnt/c/Users/$USER_NAME | |
else | |
INSTALL_PATH=~/ | |
fi | |
cd $INSTALL_PATH | |
echo "This script will install git, nvm, and node v12 and clone and setup the LATE repo in $INSTALL_PATH" | |
read -p "Press ENTER to continue or Ctrl+C to cancel." | |
} | |
function configure_git { | |
if [ $PLATFORM == 'Mac' ] && ! type git &> /dev/null; then | |
read -p 'We need to install git through XCode Command Line Tools! Press ENTER to start or Ctrl+C to cancel.' | |
xcode-select --install | |
fi | |
if [ -z "$(git config --global user.name)" ]; then | |
echo "What is your full name?" | |
read FULL_NAME | |
git config --global user.name "${FULL_NAME}" | |
else | |
echo "git name is already set, skipping..." | |
fi | |
if [ -z "$(git config --global user.email)" ]; then | |
echo "Thanks, ${FULL_NAME}. Now what email did you use for GitHub?" | |
read EMAIL | |
git config --global user.email "${EMAIL}" | |
else | |
echo "git email is already set, skipping..." | |
fi | |
} | |
function install_nvm_and_node { | |
echo "Checking for nvm..." | |
source ~/.nvm/nvm.sh | |
# Conditionally install nvm | |
if ! type nvm &> /dev/null; then | |
read -p 'Next we will install Node Version Manager (nvm). Press ENTER to start or Ctrl+C to cancel.' | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
else | |
echo nvm is already installed, skipping... | |
fi | |
# Conditionally install Node | |
if ! type node &> /dev/null; then | |
read -p 'Next we will install Node v12. Press ENTER to start or Ctrl+C to cancel.' | |
nvm install node | |
else | |
echo Node is already installed, skipping... | |
fi | |
} | |
function setup_repo { | |
if ! [ -d "late/" ]; then | |
echo 'Next we will clone the late repo to your home directory...' | |
git clone https://github.com/Apexal/late.git | |
cd late/ | |
git checkout dev | |
git pull origin dev | |
read -p "Done! Hit ENTER to install all of LATE's dependencies." | |
npm install | |
else | |
echo "The repo was already cloned, skipping..." | |
fi | |
} | |
change_directory | |
install_nvm_and_node | |
configure_git | |
setup_repo | |
echo "All done! Now make sure VSCode is installed with the proper extensions (https://github.com/Apexal/late/wiki/Code-Editor-Setup)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment