#!/bin/bash

# Initialization - DO NOT REMOVE
. helpers/initialize

##############################################################
### Customizations start here ################################
##############################################################

# Get current directory for future use in links
cd "$(dirname "$0")" || { echo "Could not change directory to $0"; exit 1;}
PROJECT_DIR=$(pwd)
export PROJECT_DIR

init_paths_and_vars

build_vim=false
is_installed "build-vim"
if prompt_yn "Build Vim from source?" ; then
    build_vim=true
fi

install_sfdc=false
if is_installed "salesforce" || prompt_yn "Install Salesforce tools?" ; then
    install_sfdc=true
fi

build_mosh=false
if ! command_exist 'mosh' && prompt_yn "Install Mosh from source?" ; then
    build_mosh=true
fi

build_tmux=false
if ! command_exist 'tmux' && prompt_yn "Install tmux from source?" ; then
    build_tmux=true
fi

build_fish=false
if ! command_exist 'fish' && prompt_yn "Install fish?" ; then
    build_fish=true
fi

### Run recipes
recipe 'dotfiles'
recipe 'bin'
recipe 'git'
recipe 'vim-settings'

if $build_vim ; then
    recipe 'build-vim'
    set_installed "build-vim"
fi

if $install_sfdc ; then
    recipe 'salesforce'
    set_installed 'salesforce'
fi

if $build_mosh ; then
    recipe 'build-mosh'
    set_installed 'build-mosh'
fi

if $build_tmux ; then
    recipe 'build-tmux'
    set_installed 'build-tmux'
fi

if $build_fish ; then
    recipe 'build-fish'
    set_installed "build-fish"
fi

if command_exist 'fish' || is_installed 'build-fish' ; then
    recipe 'fish'
fi

### Show the Finished banner
finished

# vim: set tabstop=2:softtabstop=2:shiftwidth=2:expandtab