mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Repurpose as disable flag instead of customization
This commit is contained in:
parent
a3f251477b
commit
4a54c4529d
1
defaults
1
defaults
@ -1,3 +1,2 @@
|
|||||||
# enables the use of .ruby-version like files used by other version managers
|
# enables the use of .ruby-version like files used by other version managers
|
||||||
legacy_version_file = no
|
legacy_version_file = no
|
||||||
asdf_repository_url = https://github.com/asdf-vm/asdf-plugins.git
|
|
||||||
|
@ -57,7 +57,7 @@ legacy_version_file = no
|
|||||||
use_release_candidates = no
|
use_release_candidates = no
|
||||||
always_keep_download = no
|
always_keep_download = no
|
||||||
plugin_repository_last_check_duration = 60
|
plugin_repository_last_check_duration = 60
|
||||||
asdf_repository_url = https://github.com/asdf-vm/asdf-plugins.git
|
disable_short_name_repository = yes
|
||||||
```
|
```
|
||||||
|
|
||||||
### `legacy_version_file`
|
### `legacy_version_file`
|
||||||
@ -97,13 +97,13 @@ Configure the duration since the last asdf plugin repository sync to the next. C
|
|||||||
| `0` | Sync on each trigger event |
|
| `0` | Sync on each trigger event |
|
||||||
| `never` | Never sync |
|
| `never` | Never sync |
|
||||||
|
|
||||||
### `asdf_repository_url`
|
### `disable_short_name_repository`
|
||||||
|
|
||||||
::: warning Note
|
::: warning Note
|
||||||
Custom short-name plugin repositories are not supported
|
Existing plugins available from the short-name repository will continue to be installable.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Configure the url of the short-name repository. Commands `asdf plugin add <name>` or `asdf plugin list all` will trigger a clone of the repository, if a value is set.
|
Disable installing or updating the short-name repository. Commands `asdf plugin add <name>` or `asdf plugin list all` will fail if no short-name repository has been configured.
|
||||||
|
|
||||||
| Options | Description |
|
| Options | Description |
|
||||||
| :------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------- |
|
| :------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------- |
|
||||||
|
@ -75,7 +75,7 @@ Removing a plugin will remove all installations of the tool made with the plugin
|
|||||||
## Syncing the Short-name Repository
|
## Syncing the Short-name Repository
|
||||||
|
|
||||||
::: tip Recommendation
|
::: tip Recommendation
|
||||||
The short-name repo can be disabled by removing `asdf_repository_url` from the default configuration file.
|
The short-name repo can be disabled using the flag `disable_short_name_repository`.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
The short-name repo is synced to your local machine and periodically refreshed. This period is determined by the following method:
|
The short-name repo is synced to your local machine and periodically refreshed. This period is determined by the following method:
|
||||||
|
@ -32,6 +32,10 @@ asdf_dir() {
|
|||||||
printf "%s\\n" "$ASDF_DIR"
|
printf "%s\\n" "$ASDF_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asdf_repository_url() {
|
||||||
|
printf "https://github.com/asdf-vm/asdf-plugins.git\\n"
|
||||||
|
}
|
||||||
|
|
||||||
asdf_data_dir() {
|
asdf_data_dir() {
|
||||||
local data_dir
|
local data_dir
|
||||||
|
|
||||||
@ -400,11 +404,13 @@ initialize_or_update_repository() {
|
|||||||
local repository_url
|
local repository_url
|
||||||
local repository_path
|
local repository_path
|
||||||
|
|
||||||
repository_url="$(get_asdf_config_value "asdf_repository_url")"
|
disable_short_name_repo="$(get_asdf_config_value "disable_short_name_repository")"
|
||||||
if [ -z "$repository_url" ]; then
|
if [ "yes" == "$disable_short_name_repo" ]; then
|
||||||
printf "No short-name plugin repository in configuration\\n" >&2
|
printf "Short-name plugin repository is disabled\\n" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
repository_url=$(asdf_repository_url)
|
||||||
repository_path=$(asdf_data_dir)/repository
|
repository_path=$(asdf_data_dir)/repository
|
||||||
|
|
||||||
if [ ! -d "$repository_path" ]; then
|
if [ ! -d "$repository_path" ]; then
|
||||||
|
@ -41,15 +41,16 @@ teardown() {
|
|||||||
[ "$output" = "elixir" ]
|
[ "$output" = "elixir" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_add command with no URL specified adds a plugin using repo from config" {
|
@test "plugin_add command with no URL specified adds a plugin when short name repository is enabled" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults
|
export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults
|
||||||
echo "" > $ASDF_CONFIG_DEFAULT_FILE
|
echo "" > $ASDF_CONFIG_DEFAULT_FILE
|
||||||
|
|
||||||
export ASDF_CONFIG_FILE=$BATS_TMPDIR/asdfrc
|
export ASDF_CONFIG_FILE=$BATS_TMPDIR/asdfrc
|
||||||
cat > $ASDF_CONFIG_FILE <<-EOM
|
cat > $ASDF_CONFIG_FILE <<-EOM
|
||||||
asdf_repository_url = https://github.com/asdf-vm/asdf-plugins.git
|
disable_short_name_repository=no
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
|
|
||||||
run asdf plugin add "elixir"
|
run asdf plugin add "elixir"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
@ -58,16 +59,18 @@ EOM
|
|||||||
[ "$output" = "elixir" ]
|
[ "$output" = "elixir" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_add command with no URL specified fails to add a plugin when no default repo" {
|
@test "plugin_add command with no URL specified fails to add a plugin when disabled" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults
|
export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults
|
||||||
echo "" > $ASDF_CONFIG_DEFAULT_FILE
|
echo "" > $ASDF_CONFIG_DEFAULT_FILE
|
||||||
|
|
||||||
export ASDF_CONFIG_FILE=$BATS_TMPDIR/asdfrc
|
export ASDF_CONFIG_FILE=$BATS_TMPDIR/asdfrc
|
||||||
echo "" > $ASDF_CONFIG_FILE
|
cat > $ASDF_CONFIG_FILE <<-EOM
|
||||||
|
disable_short_name_repository=yes
|
||||||
|
EOM
|
||||||
|
|
||||||
run asdf plugin add "elixir"
|
run asdf plugin add "elixir"
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 1 ]
|
||||||
[ "$output" = "No short-name plugin repository in configuration" ]
|
[ "$output" = "Short-name plugin repository is disabled" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_add command with URL specified adds a plugin using repo" {
|
@test "plugin_add command with URL specified adds a plugin using repo" {
|
||||||
|
Loading…
Reference in New Issue
Block a user