diff --git a/docs/manage/configuration.md b/docs/manage/configuration.md
index 49ea87b7f..dfe774c01 100644
--- a/docs/manage/configuration.md
+++ b/docs/manage/configuration.md
@@ -25,6 +25,7 @@ The versions can be in the following format:
- `system` - this keyword causes asdf to passthrough to the version of the tool on the system that is not managed by asdf.
::: tip
+
Multiple versions can be set by separating them with a space. For example, to use Python `3.7.2`, fallback to Python `2.7.15` and finally to the `system` Python, the following line can be added to `.tool-versions`.
```:no-line-numbers
@@ -41,18 +42,51 @@ Edit the file directly or use `asdf local` (or `asdf global`) which updates it.
## `$HOME/.asdfrc`
-Add a `.asdfrc` file to your home directory and asdf will use the settings specified in the file. The file should be formatted like this:
+Add an `.asdfrc` file to your home directory and asdf will use the settings specified in the file. The file below shows the required format with the default values to demonstrate:
```:no-line-numbers
-legacy_version_file = yes
+legacy_version_file = no
+use_release_candidates = no
+always_keep_download = no
+plugin_repository_last_check_duration = 60
```
-**Settings**
+### `legacy_version_file`
+
+Plugins **with support** can read the versions files used by other version managers, for example, `.ruby-version` in the case of Ruby's `rbenv`.
+
+| Options | Description |
+| :--------------------------------------------------------- | :------------------------------------------------------------------------- |
+| `no` | Use `.tool-versions` to read versions |
+| `yes` | Use plugin fallback to legacy version files (`.ruby-version`) if available |
+
+### `use_release_candidates`
+
+Configure the `asdf update` command to upgrade to the latest Release Candidate instead of the latest Semantic Version.
+
+| Options | Description |
+| :--------------------------------------------------------- | :------------------------ |
+| `no` | Semantic Version is used |
+| `yes` | Release Candidate is used |
+
+### `always_keep_download`
+
+Configure the `asdf install` command to keep or delete the source code or binary it downloads.
+
+| Options | Description |
+| :--------------------------------------------------------- | :---------------------------------------------------- |
+| `no` | Delete source code or binary after successful install |
+| `yes` | Keep source code or binary after install |
+
+### `plugin_repository_last_check_duration`
+
+Configure the duration since the last asdf plugin repository sync to the next. Commands `asdf plugin add ` or `asdf plugin list all` will trigger a check of the duration, if the duration has passed then a sync occurs.
-- `legacy_version_file` - defaults to `no`. If set to yes it will cause plugins that support this feature to read the version files used by other version managers (e.g. `.ruby-version` in the case of Ruby's `rbenv`).
-- `use_release_candidates` - defaults to `no`. If set to yes it will cause the `asdf update` command to upgrade to the latest release candidate release instead of the latest semantic version.
-- `always_keep_download` - defaults to `no`. If set to `yes` it will cause `asdf install` always keep the source code or binary it downloads. If set to `no` the source code or binary downloaded by `asdf install` will be deleted after successful installation.
-- `plugin_repository_last_check_duration` - defaults to `60` mins (1 hrs). It will set asdf plugins repository last check duration. When `asdf plugin add `, `asdf plugin list all` command be executed, it will check last update duration to update repository. If set to `0` it will update asdf plugins repository every time.
+| Options | Description |
+| :------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------- |
+| integer in range `1` to `999999999`
`60` is | Sync on trigger event if duration since last sync has passed |
+| `0` | Sync on each trigger event |
+| `never` | Never sync |
## Environment Variables
diff --git a/lib/utils.bash b/lib/utils.bash
index ce6aa0b96..6b7c8e074 100644
--- a/lib/utils.bash
+++ b/lib/utils.bash
@@ -379,17 +379,25 @@ get_asdf_config_value() {
get_asdf_config_value_from_file "$default_config_path" "$key"
}
+# Whether the plugin shortname repo needs to be synced
+# 0: if no sync needs to occur
+# 1: if sync needs to occur
repository_needs_update() {
- local update_file_dir
- update_file_dir="$(asdf_data_dir)/tmp"
- local update_file_name
- update_file_name="repo-updated"
- # `find` outputs filename if it has not been modified in plugin_repository_last_check_duration setting.
local plugin_repository_last_check_duration
+ local sync_required
+
plugin_repository_last_check_duration="$(get_asdf_config_value "plugin_repository_last_check_duration")"
- local find_result
- find_result=$(find "$update_file_dir" -name "$update_file_name" -type f -mmin +"${plugin_repository_last_check_duration:-60}" -print)
- [ -n "$find_result" ]
+
+ if [ "never" != "$plugin_repository_last_check_duration" ]; then
+ local update_file_dir
+ local update_file_name
+ update_file_dir="$(asdf_data_dir)/tmp"
+ update_file_name="repo-updated"
+ # `find` outputs filename if it has not been modified in plugin_repository_last_check_duration setting.
+ sync_required=$(find "$update_file_dir" -name "$update_file_name" -type f -mmin +"${plugin_repository_last_check_duration:-60}" -print)
+ fi
+
+ [ "$sync_required" ]
}
initialize_or_update_repository() {
diff --git a/test/plugin_list_all_command.bats b/test/plugin_list_all_command.bats
index 6148cd0a6..71d829b49 100644
--- a/test/plugin_list_all_command.bats
+++ b/test/plugin_list_all_command.bats
@@ -38,12 +38,25 @@ foo http://example.com/foo"
[ "$output" = "$expected" ]
}
+@test "plugin_list_all skips repo sync because check_duration is set to never" {
+ echo 'plugin_repository_last_check_duration = never' > $HOME/.asdfrc
+ run asdf plugin-list-all
+ local expected="\
+bar http://example.com/bar
+dummy *http://example.com/dummy
+foo http://example.com/foo"
+
+ [ "$status" -eq 0 ]
+ [ "$output" = "$expected" ]
+}
+
@test "plugin_list_all list all plugins in the repository" {
run asdf plugin-list-all
local expected="\
bar http://example.com/bar
dummy *http://example.com/dummy
foo http://example.com/foo"
+
[ "$status" -eq 0 ]
[ "$output" = "$expected" ]
}