#!/bin/bash
#
# Default for ~/.tig/tigrc

export TIG_ROOT="${TIG_HOME-"$HOME/.tig"}"
export TIGRC_PATH="${TIG_ROOT}/tigrc"
export TIG_JSON_PATH="${TIG_ROOT}/tig.json"
export TIG_LINK_JSON_PATH="${TIG_ROOT}/tig-link.json"

### --PLATFORM--
### Figure out what platform this OS this is and standardize it

PLATFORM="unknown"  ### The name of the platform
PNAME="unknown"     ### The general name of the platform (unix / windows)

unix_name=$(uname)
shopt -s nocasematch
case "$unix_name" in
  *unix*)
    PLATFORM="unix"
    ;;
  *linux*)
    PLATFORM="linux"
    ;;
  *freebsd*)
    PLATFORM="freebsd"
    ;;
  *darwin*)
    PLATFORM="osx"
    ;;
  *windows*|*ming*)
    PLATFORM="windows"
    ;;
esac

case "$PLATFORM" in
  linux|unix|freebsd|osx)
  PNAME="unix"
  ;;
  windows)
  PNAME="windows"
  ;;
  *)
  >&2 echo "Unable to classify the system OS -> uname: $unix_name, PLATFORM: $PLATFORM"
  exit 1
esac

### --OS INFO--
### Export all OS high level info here

export PLATFORM
export PNAME


### --ANSI COLOR CODES--
### Export all ANSI color codes

export NC='\033[0m'         #NO COLOR
export BLACK='\033[0;30m'
export RED='\033[0;31m'
export GREEN='\033[0;32m'
export BROWN_ORANGE='\033[0;33m'
export BLUE='\033[0;34m'
export PURPLE='\033[0;35m'
export CYAN='\033[0;36m'
export LIGHT_GRAY='\033[0;37m'
export DARK_GRAY='\033[1;30m'
export LIGHT_RED='\033[1;31m'
export LIGHT_GREEN='\033[1;32m'
export YELLOW='\033[1;33m'
export LIGHT_BLUE='\033[1;34m'
export LIGHT_PURPLE='\033[1;35m'
export LIGHT_CYAN='\033[1;36m'
export WHITE='\033[1;37m'


### --URLs--
### Store any commonly used URLs here

export TIG_SH_URL_BASE="https://tig.sh"
export TIG_LINK_URL_BASE="https://tig.link"
export GIT_URL_BASE="https://github.com"
export GIT_TIG_LINK_URL="${GIT_URL_BASE}/cchamberlain/tig-link"

### --PATHS--
### All paths are absolute.
### ROOT suffix => directory, PATH suffix => file

export NPMRC_PATH="${HOME}/.npmrc"

# All source code gets installed here by default
export SRC_ROOT="${HOME}/src"
export SRC_BIN_ROOT="${SRC_ROOT}/bin"

export LOCAL_ROOT="${HOME}/local"
export LOCAL_BIN_ROOT="${LOCAL_ROOT}/bin"

# Code being prepared for build and other tasks gets synced here
export SYNC_ROOT="${TIG_ROOT}/sync"

# After code revision has been synced, it is built to this directory.
# Each project will have its own build folder relative to this root.
export BUILD_ROOT="${TIG_ROOT}/build"

# After code has been built, artifact zips are deployed here.  Default format is 7z with highest compression.
export ARTIFACTS_ROOT="${TIG_ROOT}/artifacts"


