Skip to content

Commit

Permalink
Fix asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jul 2, 2020
1 parent bceac8a commit 8f512eb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ dist/
downloads/
eggs/
.eggs/
lib/
#lib/
lib64/
parts/
sdist/
Expand Down
2 changes: 1 addition & 1 deletion tmux/.config/tmux/+plugins/tpm
17 changes: 10 additions & 7 deletions zsh.common/.config/zshrc.d/autoloaded/asdf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# vim: set foldmethod=marker filetype=zsh :

boot-asdf() {
local asdf_version="v0.6.2"
local asdf_url=https://github.com/asdf-vm/asdf.git
local latest

export ASDF_DIR="$HOME/.local/opt/asdf"
export ASDF_DATA_DIR="$XDG_DATA_HOME/asdf"
Expand All @@ -14,14 +12,17 @@ boot-asdf() {
echo -e "\`asdf\` not found. Downloading ...\n"
mkdir -p "$(dirname "$ASDF_DIR")"
mkdir -p "$(dirname "$ASDF_DATA_DIR")"
git clone --single-branch --branch $asdf_version $asdf_url $ASDF_DIR
git clone $asdf_url $ASDF_DIR
( cd $ASDF_DIR;
git checkout "$(git describe --abbrev=0 --tags)";
chmod -R go-w .
)
echo -e "DONE\n=========================================================\n"
elif (( $(age $ASDF_DIR) > 30 )); then
elif (( $(old "$ASDF_DIR") > 30 )); then
( cd $ASDF_DIR;
echo "\`asdf\` is too old. Fetching newest changes ...";
git fetch --tags;
latest="$(git describe --tags "$(git rev-list --tags --max-count=1)")";
git checkout "$latest" &>/dev/null;
git checkout "$(git describe --abbrev=0 --tags)"
touch . # Make sure to change ctime of the repo, so it waits 30 days
)
fi
Expand All @@ -30,5 +31,7 @@ boot-asdf() {
boot-asdf
unfunction asdf
source $ASDF_DIR/asdf.sh
source $ASDF_DIR/completions/asdf.bash
fpath=(${ASDF_DIR}/completions $fpath)
autoload -Uz compinit
compinit
asdf "$@"

0 comments on commit 8f512eb

Please sign in to comment.