Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename internal plugin repository functions #1537

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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