mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Simplify vocabulary
This commit is contained in:
parent
dcaee06337
commit
d687a86ab6
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
installs
|
installs
|
||||||
sources
|
sources
|
||||||
|
plugins
|
||||||
shims
|
shims
|
||||||
|
|
||||||
|
30
README.md
30
README.md
@ -2,11 +2,11 @@
|
|||||||
### _extendable version manager_
|
### _extendable version manager_
|
||||||
|
|
||||||
> I've built plugins to support the following languages:
|
> I've built plugins to support the following languages:
|
||||||
> * [Ruby](#TODO)
|
> * [Ruby](https://github.com/HashNuke/asdf-ruby)
|
||||||
> * [Erlang](https://github.com/HashNuke/asdf-erlang)
|
> * [Erlang](https://github.com/HashNuke/asdf-erlang)
|
||||||
> * [Elixir](https://github.com/HashNuke/asdf-elixir)
|
> * [Elixir](https://github.com/HashNuke/asdf-elixir)
|
||||||
>
|
>
|
||||||
> There is a [super-simple API](https://github.com/HashNuke/asdf/blob/master/docs/creating-package-sources.md) for supporting more languages.
|
> There is a [super-simple API](https://github.com/HashNuke/asdf/blob/master/docs/creating-plugins.md) for supporting more languages.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -36,40 +36,40 @@ echo 'source $HOME/.asdf/asdf.sh' >> ~/.bash_profile
|
|||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
### Manage sources
|
### Manage plugins
|
||||||
|
|
||||||
Sources are how asdf understands how to handle packages.
|
Plugins are how asdf understands how to handle different packages.
|
||||||
|
|
||||||
|
|
||||||
##### Add a package source
|
##### Add a plugin
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
asdf source-add <name> <git-url>
|
asdf plugin-add <name> <git-url>
|
||||||
# asdf add-source erlang https://github.com/HashNuke/asdf-erlang.git
|
# asdf plugin-add erlang https://github.com/HashNuke/asdf-erlang.git
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Remove a source
|
##### Remove a plugin
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
asdf source-remove <name>
|
asdf plugin-remove <name>
|
||||||
# asdf remove-source erlang
|
# asdf plugin-remove erlang
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
##### Update sources
|
##### Update plugins
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
asdf source-update --all
|
asdf plugin-update --all
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to update a specific package, just say so.
|
If you want to update a specific package, just say so.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
asdf source-update <name>
|
asdf plugin-update <name>
|
||||||
# asdf update-source erlang
|
# asdf plugin-update erlang
|
||||||
```
|
```
|
||||||
|
|
||||||
### Manage packages
|
### Manage versions
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
asdf install <name> <version>
|
asdf install <name> <version>
|
||||||
|
18
bin/asdf
18
bin/asdf
@ -8,9 +8,9 @@ source $(dirname $(dirname $0))/lib/commands/uninstall.sh
|
|||||||
source $(dirname $(dirname $0))/lib/commands/list.sh
|
source $(dirname $(dirname $0))/lib/commands/list.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/list-all.sh
|
source $(dirname $(dirname $0))/lib/commands/list-all.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/reshim.sh
|
source $(dirname $(dirname $0))/lib/commands/reshim.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/source-add.sh
|
source $(dirname $(dirname $0))/lib/commands/plugin-add.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/source-update.sh
|
source $(dirname $(dirname $0))/lib/commands/plugin-update.sh
|
||||||
source $(dirname $(dirname $0))/lib/commands/source-remove.sh
|
source $(dirname $(dirname $0))/lib/commands/plugin-remove.sh
|
||||||
|
|
||||||
|
|
||||||
callback_args="${@:2}"
|
callback_args="${@:2}"
|
||||||
@ -38,14 +38,14 @@ case $1 in
|
|||||||
"reshim")
|
"reshim")
|
||||||
reshim_command $callback_args;;
|
reshim_command $callback_args;;
|
||||||
|
|
||||||
"source-add")
|
"plugin-add")
|
||||||
source_add_command $callback_args;;
|
plugin_add_command $callback_args;;
|
||||||
|
|
||||||
"source-update")
|
"plugin-update")
|
||||||
source_update_command $callback_args;;
|
plugin_update_command $callback_args;;
|
||||||
|
|
||||||
"source-remove")
|
"plugin-remove")
|
||||||
source_remove_command $callback_args;;
|
plugin_remove_command $callback_args;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
help_command
|
help_command
|
||||||
|
@ -6,7 +6,7 @@ package=$1
|
|||||||
executable_path=$2
|
executable_path=$2
|
||||||
|
|
||||||
source_path=$(get_source_path $package)
|
source_path=$(get_source_path $package)
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
|
|
||||||
full_version=$(get_preset_version_for $package)
|
full_version=$(get_preset_version_for $package)
|
||||||
|
|
||||||
|
18
help.txt
18
help.txt
@ -1,16 +1,16 @@
|
|||||||
MANAGE PACKAGE SOURCES
|
MANAGE PLUGINS
|
||||||
|
|
||||||
asdf source-add <name> <git-url>
|
asdf plugin-add <name> <git-url>
|
||||||
Add git repo as source for a package
|
Add git repo as plugin
|
||||||
|
|
||||||
asdf source-remove <name>
|
asdf plugin-remove <name>
|
||||||
Remove package source and versions
|
Remove plugin and versions
|
||||||
|
|
||||||
asdf source-update <name>
|
asdf plugin-update <name>
|
||||||
Update package source
|
Update plugin
|
||||||
|
|
||||||
asdf source-updatee --all
|
asdf plugin-updatee --all
|
||||||
Update sources for all packages
|
Update all plugins
|
||||||
|
|
||||||
|
|
||||||
MANAGE PACKAGES
|
MANAGE PACKAGES
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
install_command() {
|
install_command() {
|
||||||
local package_name=$1
|
local package_name=$1
|
||||||
local full_version=$2
|
local full_version=$2
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
|
|
||||||
IFS=':' read -a version_info <<< "$full_version"
|
IFS=':' read -a version_info <<< "$full_version"
|
||||||
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
||||||
@ -14,6 +14,6 @@ install_command() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local install_path=$(get_install_path $package_name $install_type $version)
|
local install_path=$(get_install_path $package_name $install_type $version)
|
||||||
${source_path}/bin/install $install_type $version $install_path
|
${plugin_path}/bin/install $install_type $version $install_path
|
||||||
reshim_command $package_name $full_version
|
reshim_command $package_name $full_version
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
list_all_command() {
|
list_all_command() {
|
||||||
local package_name=$1
|
local package_name=$1
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
local versions=$( ${source_path}/bin/list-all )
|
local versions=$( ${plugin_path}/bin/list-all )
|
||||||
|
|
||||||
IFS=' ' read -a versions_list <<< "$versions"
|
IFS=' ' read -a versions_list <<< "$versions"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
list_command() {
|
list_command() {
|
||||||
local package_name=$1
|
local package_name=$1
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
|
|
||||||
local package_installs_path=$(asdf_dir)/installs/${package_name}
|
local package_installs_path=$(asdf_dir)/installs/${package_name}
|
||||||
|
|
||||||
|
11
lib/commands/plugin-add.sh
Normal file
11
lib/commands/plugin-add.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
plugin_add_command() {
|
||||||
|
local package_name=$1
|
||||||
|
local source_url=$2
|
||||||
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
|
|
||||||
|
mkdir -p $(asdf_dir)/sources
|
||||||
|
git clone $source_url $plugin_path
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
chmod +x $plugin_path/bin/*
|
||||||
|
fi
|
||||||
|
}
|
7
lib/commands/plugin-remove.sh
Normal file
7
lib/commands/plugin-remove.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
plugin_remove_command() {
|
||||||
|
local package_name=$1
|
||||||
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
|
|
||||||
|
rm -rf $plugin_path
|
||||||
|
rm -rf $(asdf_dir)/installs/${package_name}
|
||||||
|
}
|
@ -1,12 +1,12 @@
|
|||||||
source_update_command() {
|
plugin_update_command() {
|
||||||
local package_name=$1
|
local package_name=$1
|
||||||
if [ "$package_name" = "--all" ]; then
|
if [ "$package_name" = "--all" ]; then
|
||||||
for dir in $(asdf_dir)/sources/*; do
|
for dir in $(asdf_dir)/sources/*; do
|
||||||
(cd "$dir" && git pull)
|
(cd "$dir" && git pull)
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
(cd $source_path; git pull)
|
(cd $plugin_path; git pull)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
@ -2,8 +2,8 @@ reshim_command() {
|
|||||||
local package_name=$1
|
local package_name=$1
|
||||||
local full_version=$2
|
local full_version=$2
|
||||||
local executable_path=$3
|
local executable_path=$3
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
ensure_shims_dir
|
ensure_shims_dir
|
||||||
|
|
||||||
# If full version is empty then generate shims for all versions in the package
|
# If full version is empty then generate shims for all versions in the package
|
||||||
@ -52,9 +52,9 @@ generate_shim_for_executable() {
|
|||||||
local package_name=$1
|
local package_name=$1
|
||||||
local full_version=$2
|
local full_version=$2
|
||||||
local executable=$3
|
local executable=$3
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
|
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
|
|
||||||
IFS=':' read -a version_info <<< "$full_version"
|
IFS=':' read -a version_info <<< "$full_version"
|
||||||
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
||||||
@ -72,8 +72,8 @@ generate_shim_for_executable() {
|
|||||||
generate_shims_for_version() {
|
generate_shims_for_version() {
|
||||||
local package_name=$1
|
local package_name=$1
|
||||||
local full_version=$2
|
local full_version=$2
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
|
|
||||||
IFS=':' read -a version_info <<< "$full_version"
|
IFS=':' read -a version_info <<< "$full_version"
|
||||||
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
||||||
@ -86,8 +86,8 @@ generate_shims_for_version() {
|
|||||||
|
|
||||||
local install_path=$(get_install_path $package_name $install_type $version)
|
local install_path=$(get_install_path $package_name $install_type $version)
|
||||||
|
|
||||||
if [ -f ${source_path}/bin/list-bin-paths ]; then
|
if [ -f ${plugin_path}/bin/list-bin-paths ]; then
|
||||||
local space_seperated_list_of_bin_paths=$(sh ${source_path}/bin/list-bin-paths $package_name $install_type $version "${@:2}")
|
local space_seperated_list_of_bin_paths=$(sh ${plugin_path}/bin/list-bin-paths $package_name $install_type $version "${@:2}")
|
||||||
else
|
else
|
||||||
local space_seperated_list_of_bin_paths="bin"
|
local space_seperated_list_of_bin_paths="bin"
|
||||||
fi
|
fi
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
source_add_command() {
|
|
||||||
local package_name=$1
|
|
||||||
local source_url=$2
|
|
||||||
local source_path=$(get_source_path $package_name)
|
|
||||||
|
|
||||||
mkdir -p $(asdf_dir)/sources
|
|
||||||
git clone $source_url $source_path
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
chmod +x $source_path/bin/*
|
|
||||||
fi
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
source_remove_command() {
|
|
||||||
local package_name=$1
|
|
||||||
local source_path=$(get_source_path $package_name)
|
|
||||||
|
|
||||||
rm -rf $source_path
|
|
||||||
rm -rf $(asdf_dir)/installs/${package_name}
|
|
||||||
}
|
|
@ -1,9 +1,9 @@
|
|||||||
uninstall_command() {
|
uninstall_command() {
|
||||||
local package_name=$1
|
local package_name=$1
|
||||||
local full_version=$2
|
local full_version=$2
|
||||||
local source_path=$(get_source_path $package_name)
|
local plugin_path=$(get_plugin_path $package_name)
|
||||||
|
|
||||||
check_if_source_exists $source_path
|
check_if_plugin_exists $plugin_path
|
||||||
|
|
||||||
IFS=':' read -a version_info <<< "$full_version"
|
IFS=':' read -a version_info <<< "$full_version"
|
||||||
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
||||||
@ -21,8 +21,8 @@ uninstall_command() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${source_path}/bin/uninstall ]; then
|
if [ -f ${plugin_path}/bin/uninstall ]; then
|
||||||
${source_path}/bin/uninstall $install_type $version $install_path "${@:3}"
|
${plugin_path}/bin/uninstall $install_type $version $install_path "${@:3}"
|
||||||
else
|
else
|
||||||
rm -rf $install_path
|
rm -rf $install_path
|
||||||
fi
|
fi
|
||||||
|
@ -28,10 +28,10 @@ get_install_path() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
check_if_source_exists() {
|
check_if_plugin_exists() {
|
||||||
if [ ! -d $1 ]
|
if [ ! -d $1 ]
|
||||||
then
|
then
|
||||||
display_error "No such package"
|
display_error "No such plugin"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -43,8 +43,8 @@ get_version_part() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
get_source_path() {
|
get_plugin_path() {
|
||||||
echo $(asdf_dir)/sources/$1
|
echo $(asdf_dir)/plugins/$1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user