Skip to content

Instantly share code, notes, and snippets.

@QuotableWater7
Created February 7, 2020 04:35
Show Gist options
  • Select an option

  • Save QuotableWater7/40f560624ff594b8789944b07032f12a to your computer and use it in GitHub Desktop.

Select an option

Save QuotableWater7/40f560624ff594b8789944b07032f12a to your computer and use it in GitHub Desktop.

Revisions

  1. JT created this gist Feb 7, 2020.
    64 changes: 64 additions & 0 deletions first-time-env-setup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    #!/bin/bash

    BIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

    # add a newline before printing text
    fancy_echo() {
    local fmt="$1"; shift

    printf '\n%s\n' "$fmt" "$@"
    }

    install_homebrew() {
    if ! command -v brew >/dev/null; then
    fancy_echo "Installing Homebrew ..."
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    fi

    fancy_echo "Updating Homebrew formulae ..."
    brew update
    }

    install_homebrew_packages() {
    brew install git git-crypt docker hub heroku
    }

    install_and_set_up_node() {
    # Install NVM
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

    # Install Node and set default version
    # shellcheck disable=SC1090
    source ~/.nvm/nvm.sh && nvm install 10.15.1
    nvm alias default 10.15.1
    }

    configure_git() {
    git remote add prod https://git.heroku.com/bc-prod.git
    git remote add stage https://git.heroku.com/bc-stage.git
    git remote add alpha https://git.heroku.com/bc-alpha.git
    git remote add dev https://git.heroku.com/bc-dev.git
    git remote add dev2 https://git.heroku.com/bc-dev-2.git
    }

    git_clone_repos() {
    [ ! -d "~/Documents/BC" ] && (cd ~/Documents && git clone [email protected]:BuildingConnected/BC.git)
    [ ! -d "~/Documents/client" ] && (cd ~/Documents && git clone [email protected]:BuildingConnected/client.git)
    }

    npm_install() {
    (cd ~/Documents/BC && npm i)
    (cd ~/Documents/client && npm i)
    }

    seed_database() {
    fancy_echo "If you want to seed your local database, visit https://github.com/BuildingConnected/BC/blob/master/server/scripts/review-apps/db-snapshotting/tutorial.md#preserve-your-current-database--before-tutorial-"
    }

    install_homebrew
    install_homebrew_packages
    install_and_set_up_node
    git_clone_repos
    configure_git
    npm_install
    seed_database