Skip to content

Commit de65159

Browse files
Replaced git_install_asdf with brew install asdf
1 parent f0a12de commit de65159

File tree

4 files changed

+10
-28
lines changed

4 files changed

+10
-28
lines changed

MacOS/base

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function are_basics_installed() {
1414
# `awscli` https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html
1515
declare -a BREW_BASICS=(
1616
'actionlint'
17+
'asdf'
1718
'awscli'
1819
'bash'
1920
'coreutils'
@@ -68,6 +69,6 @@ function is_asdf_installed() {
6869
msg_info 'Will try to install asdf dependencies'
6970
install_if_not_installed 'brew' "${ASK}" "${ASDF_DEPS[@]}"
7071
msg_info 'Will try to install asdf using git'
71-
git_install_asdf "${ASK}"
72+
source_asdf
7273
fi
7374
}

Ubuntu/base

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function are_basics_installed() {
4343
BREW_BASICS=(
4444
'actionlint'
4545
'asciidoc'
46+
'asdf'
4647
'awscli'
4748
'fontconfig'
4849
'gcc'
@@ -93,7 +94,6 @@ function is_asdf_installed() {
9394
msg_info 'Will try to install asdf dependencies'
9495
install_if_not_installed 'apt' "${ASK}" "${ASDF_DEPS[@]}"
9596
msg_info 'Will try to install asdf using git'
96-
git_install_asdf "${ASK}"
97+
source_asdf
9798
fi
98-
source_asdf
9999
}

bash_aliases

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ function pkg_update_asdf() {
365365
git pull
366366
cd - || return 1
367367

368-
msg_info 'asdf update; asdf plugin-update --all'
369-
asdf update; asdf plugin-update --all
368+
msg_info 'asdf plugin-update --all'
369+
asdf plugin-update --all
370370
}
371371

372372
function pkg_update_nodejs() {

lib/utils

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ function get_latest_github_tag() {
8888
function source_asdf() {
8989
disableStrictMode
9090
# shellcheck disable=SC1091
91-
. "${HOME}"/.asdf/asdf.sh
92-
# shellcheck disable=SC1091
93-
. "${HOME}"/.asdf/completions/asdf.bash
91+
. "$(brew --prefix)"/opt/asdf/libexec/asdf.sh
92+
export ASDF_DATA_DIR="${HOME}/.asdf"
93+
# shellcheck disable=SC1090
94+
. <(asdf completion bash)
9495
strictMode
9596
}
9697

@@ -365,26 +366,6 @@ function get_git_tags() {
365366
| LC_ALL=C sort -t '.' -k 1,1n -k 2,2n -k 3,3n -k 4,4d -k 5,5d
366367
}
367368

368-
function git_install_asdf() {
369-
# How to:
370-
# only to be used within is_asdf_installed function
371-
# in ${GITROOT}/(Ubuntu|MacOS)/base
372-
local ASK="${1:-'y'}"
373-
local ANSWER='y'
374-
declare -a ASDF_TAGS=()
375-
msg_info 'Seems like asdf is not installed'
376-
if [[ "${ASK}" == 'y' ]]; then
377-
ANSWER="$(get_user_reply 'Want me to install asdf?')"
378-
echo
379-
fi
380-
if [[ ${ANSWER} =~ ^[Yy]$ ]]; then
381-
local ASDF_REPO="https://github.com/asdf-vm/asdf.git"
382-
mapfile -t ASDF_TAGS < <(get_git_tags ${ASDF_REPO})
383-
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch "v${ASDF_TAGS[-1]}"
384-
source_asdf
385-
fi
386-
}
387-
388369
function install_asdf_tool_versions() {
389370
# How to:
390371
# only to be used after asdf has been installed and asdf's:

0 commit comments

Comments
 (0)