Skip to content

Commit

Permalink
fix: rename internal plugin repository functions (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
jthegedus authored Apr 12, 2023
1 parent 491ef2a commit 5367f1f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/commands/command-plugin-list-all.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- sh -*-

plugin_list_all_command() {
initialize_or_update_repository
initialize_or_update_plugin_repository

local plugins_index_path
plugins_index_path="$(asdf_data_dir)/repository/plugins"
Expand Down
2 changes: 1 addition & 1 deletion lib/functions/plugins.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ plugin_add_command() {
if [ -n "$2" ]; then
local source_url=$2
else
initialize_or_update_repository
initialize_or_update_plugin_repository
local source_url
source_url=$(get_plugin_source_url "$plugin_name")
fi
Expand Down
9 changes: 5 additions & 4 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ asdf_dir() {
fi
}

asdf_repository_url() {
asdf_plugin_repository_url() {
printf "https://github.com/asdf-vm/asdf-plugins.git\n"
}

Expand Down Expand Up @@ -418,7 +418,7 @@ repository_needs_update() {
[ "$sync_required" ]
}

initialize_or_update_repository() {
initialize_or_update_plugin_repository() {
local repository_url
local repository_path

Expand All @@ -428,15 +428,16 @@ initialize_or_update_repository() {
exit 1
fi

repository_url=$(asdf_repository_url)
repository_url=$(asdf_plugin_repository_url)
repository_path=$(asdf_data_dir)/repository

if [ ! -d "$repository_path" ]; then
printf "initializing plugin repository..."
git clone "$repository_url" "$repository_path"
elif repository_needs_update; then
printf "updating plugin repository..."
(cd "$repository_path" && git fetch && git reset --hard origin/master)
git -C "$repository_path" fetch
git -C "$repository_path" reset --hard origin/master
fi

mkdir -p "$(asdf_data_dir)/tmp"
Expand Down

0 comments on commit 5367f1f

Please sign in to comment.