working through some setup fixes -> good checkpoint
This commit is contained in:
+25
-25
@@ -1,74 +1,74 @@
|
||||
#####################################################################
|
||||
|
||||
SETUP__GIT() {
|
||||
local SOURCES_DIR="${XDG_DATA_HOME:-${HOME}/.local/share}/project-source-code"
|
||||
setup.git() {
|
||||
local sources_dir="${XDG_DATA_HOME:-${HOME}/.local/share}/project-source-code"
|
||||
|
||||
SOURCE_DIR="${DOTWRYN_PATH}" \
|
||||
TARGET_DIR="${SOURCES_DIR}/yage/dotwryn" \
|
||||
TARGET_DIR="${sources_dir}/yage/dotwryn" \
|
||||
REMOTE_UPSTREAMS=(
|
||||
'git@github.com:wrynegade/dotwryn.git'
|
||||
'git@yage.io:wrynegade/dotwryn.git'
|
||||
'git@bitbucket.org:wrynegade/dotwryn.git'
|
||||
) SETUP__GIT__REMOTES '.wryn'
|
||||
) setup.git._.remotes '.wryn'
|
||||
|
||||
SOURCE_DIR="${DOTWRYN_PATH}/zsh/plugins/code-activator" \
|
||||
TARGET_DIR="${SOURCES_DIR}/zsh/code-activator" \
|
||||
TARGET_DIR="${sources_dir}/zsh/code-activator" \
|
||||
REMOTE_UPSTREAMS=(
|
||||
'git@yage.io:zsh/code-activator.git'
|
||||
'git@github.com:wrynegade/code-activator.git'
|
||||
) SETUP__GIT__REMOTES 'zsh-plugins/code-activator'
|
||||
) setup.git._.remotes 'zsh-plugins/code-activator'
|
||||
|
||||
SOURCE_DIR="${DOTWRYN_PATH}/zsh/plugins/scwrypts" \
|
||||
TARGET_DIR="${SOURCES_DIR}/zsh/scwrypts" \
|
||||
TARGET_DIR="${sources_dir}/zsh/scwrypts" \
|
||||
REMOTE_UPSTREAMS=(
|
||||
'git@yage.io:zsh/scwrypts'
|
||||
'git@github.com:wrynegade/scwrypts'
|
||||
) SETUP__GIT__REMOTES 'zsh-plugins/scwrypts'
|
||||
) setup.git._.remotes 'zsh-plugins/scwrypts'
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
SETUP__GIT__REMOTES() {
|
||||
setup.git._.remotes() {
|
||||
: \
|
||||
&& [ "${SOURCE_DIR}" ] \
|
||||
&& [ "${TARGET_DIR}" ] \
|
||||
&& [[ ${#REMOTE_UPSTREAMS[@]} -gt 0 ]] \
|
||||
|| return 1
|
||||
|
||||
[ "$1" ] && STATUS "updating remotes for '$1'"
|
||||
[ "$1" ] && echo.status "updating remotes for '$1'"
|
||||
|
||||
git -C "${SOURCE_DIR}" remote rm upstream 2>/dev/null
|
||||
git -C "${SOURCE_DIR}" remote add upstream ${REMOTE_UPSTREAMS[1]}
|
||||
git -C "${SOURCE_DIR}" remote add upstream "${REMOTE_UPSTREAMS[1]}"
|
||||
|
||||
local REMOTE_UPSTREAM
|
||||
for REMOTE_UPSTREAM in ${REMOTE_UPSTREAMS[@]}
|
||||
local remote_upstream
|
||||
for remote_upstream in "${REMOTE_UPSTREAMS[@]}"
|
||||
do
|
||||
git -C "${SOURCE_DIR}" remote set-url --add --push upstream "${REMOTE_UPSTREAM}"
|
||||
git -C "${SOURCE_DIR}" remote set-url --add --push upstream "${remote_upstream}"
|
||||
|
||||
case ${REMOTE_UPSTREAM} in
|
||||
git@github.com:* )
|
||||
case "${remote_upstream}" in
|
||||
( git@github.com:* )
|
||||
git -C "${SOURCE_DIR}" remote rm github 2>/dev/null
|
||||
git -C "${SOURCE_DIR}" remote add github "${REMOTE_UPSTREAM}"
|
||||
git -C "${SOURCE_DIR}" remote add github "${remote_upstream}"
|
||||
;;
|
||||
git@yage.io:* )
|
||||
( git@yage.io:* )
|
||||
git -C "${SOURCE_DIR}" remote rm yage 2>/dev/null
|
||||
git -C "${SOURCE_DIR}" remote add yage "${REMOTE_UPSTREAM}"
|
||||
git -C "${SOURCE_DIR}" remote add yage "${remote_upstream}"
|
||||
;;
|
||||
git@bitbucket.org:* )
|
||||
( git@bitbucket.org:* )
|
||||
git -C "${SOURCE_DIR}" remote rm bitbucket 2>/dev/null
|
||||
git -C "${SOURCE_DIR}" remote add bitbucket "${REMOTE_UPSTREAM}"
|
||||
git -C "${SOURCE_DIR}" remote add bitbucket "${remote_upstream}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
unset remote_upstream
|
||||
|
||||
SOURCE_DIR="${SOURCE_DIR}" TARGET_DIR="${TARGET_DIR}" SETUP__GIT__LINK_TO_PROJECTS || {
|
||||
WARNING "failed to link '${TARGET_DIR}'"
|
||||
}
|
||||
SOURCE_DIR="${SOURCE_DIR}" TARGET_DIR="${TARGET_DIR}" setup.git._.link-to-projects \
|
||||
|| echo.warning "failed to link '${TARGET_DIR}'"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
SETUP__GIT__LINK_TO_PROJECTS() {
|
||||
setup.git._.link-to-projects() {
|
||||
[ "${TARGET_DIR}" ] && [ "${SOURCE_DIR}" ] \
|
||||
|| return 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user