Skip to content

Commit

Permalink
feat(#15): updated install script
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumfate committed Nov 16, 2023
1 parent 8e5744f commit a99c80c
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions utils/installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ structlog_url="https://github.com/Tastyep/structlog.nvim.git"

declare -xr NVIM_APPNAME="${NVIM_APPNAME:-"qvim"}"

#Set branch to master unless specified by the user
declare -x QV_BRANCH="${QV_BRANCH:-"main"}"
declare -xr QV_REMOTE="${QV_REMOTE:-"quantumfate/qvim.git"}"
declare -xr QV_REMOTE="${QV_REMOTE:-"QuantumVim/QuantumVim.git"}"

declare -xr QV_CONFIG_BRANCH="${QV_CONFIG_BRANCH:-"main"}"
declare -xr QV_CONFIG_REMOTE="${QV_CONFIG_REMOTE:-"QuantumVim/config.git"}"

declare -xr INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}"

declare -xr XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}"
Expand Down Expand Up @@ -42,6 +45,21 @@ declare ARGS_OVERWRITE=0
declare ADDITIONAL_WARNINGS=""
declare USE_SSH=0

declare -a __qvim_remotes=(
"$QV_REMOTE"
"$QV_CONFIG_REMOTE"
)

declare -a __qvim_branches=(
"$QV_BRANCH"
"$QV_CONFIG_BRANCH"
)

declare -a __qvim_destinations=(
"$QUANTUMVIM_RTP_DIR"
"$QUANTUMVIM_CONFIG_DIR"
)

declare -a __qvim_dirs=(
"$QUANTUMVIM_STATE_DIR"
"$QUANTUMVIM_CACHE_DIR"
Expand Down Expand Up @@ -274,22 +292,28 @@ function verify_qvim_dirs() {
}

function clone_qvim() {
msg "Cloning QuantumVim configuration"
msg "Cloning QuantumVim Repositories"

if [ "$USE_SSH" -eq 0 ]; then
for scope in "${!__qvim_remotes[@]}"; do
local repo="${__qvim_remotes[$scope]}"
local branch="${__qvim_branches[$scope]}"
local destination="${__qvim_destinations[$scope]}"
local method=""

if ! git clone --branch "$QV_BRANCH" \
"https://github.com/${QV_REMOTE}" "$QUANTUMVIM_RTP_DIR"; then
echo "Failed to clone repository. Installation failed."
exit 1
__backup_dir "$destination"

if [ "$USE_SSH" -eq 0 ]; then
method="https://github.com/"
else
method="[email protected]:/"
fi
else
if ! git clone --branch "$QV_BRANCH" \
"[email protected]:${QV_REMOTE}" "$QUANTUMVIM_RTP_DIR"; then
echo "Failed to clone repository. Installation failed."
if ! git clone --branch "$branch" \
"${method}${repo}" "$destination"; then
echo "Failed to clone repository '${repo}'. Installation failed."
exit 1
fi
fi
msg "Cloned $repo to $destination"
done
}

function setup_exec() {
Expand Down

0 comments on commit a99c80c

Please sign in to comment.