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
|
||||
sources
|
||||
plugins
|
||||
shims
|
||||
|
||||
|
30
README.md
30
README.md
@ -2,11 +2,11 @@
|
||||
### _extendable version manager_
|
||||
|
||||
> 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)
|
||||
> * [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
|
||||
|
||||
### 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
|
||||
asdf source-add <name> <git-url>
|
||||
# asdf add-source erlang https://github.com/HashNuke/asdf-erlang.git
|
||||
asdf plugin-add <name> <git-url>
|
||||
# asdf plugin-add erlang https://github.com/HashNuke/asdf-erlang.git
|
||||
```
|
||||
|
||||
##### Remove a source
|
||||
##### Remove a plugin
|
||||
|
||||
```bash
|
||||
asdf source-remove <name>
|
||||
# asdf remove-source erlang
|
||||
asdf plugin-remove <name>
|
||||
# asdf plugin-remove erlang
|
||||
```
|
||||
|
||||
|
||||
##### Update sources
|
||||
##### Update plugins
|
||||
|
||||
```bash
|
||||
asdf source-update --all
|
||||
asdf plugin-update --all
|
||||
```
|
||||
|
||||
If you want to update a specific package, just say so.
|
||||
|
||||
```bash
|
||||
asdf source-update <name>
|
||||
# asdf update-source erlang
|
||||
asdf plugin-update <name>
|
||||
# asdf plugin-update erlang
|
||||
```
|
||||
|
||||
### Manage packages
|
||||
### Manage versions
|
||||
|
||||
```bash
|
||||
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-all.sh
|
||||
source $(dirname $(dirname $0))/lib/commands/reshim.sh
|
||||
source $(dirname $(dirname $0))/lib/commands/source-add.sh
|
||||
source $(dirname $(dirname $0))/lib/commands/source-update.sh
|
||||
source $(dirname $(dirname $0))/lib/commands/source-remove.sh
|
||||
source $(dirname $(dirname $0))/lib/commands/plugin-add.sh
|
||||
source $(dirname $(dirname $0))/lib/commands/plugin-update.sh
|
||||
source $(dirname $(dirname $0))/lib/commands/plugin-remove.sh
|
||||
|
||||
|
||||
callback_args="${@:2}"
|
||||
@ -38,14 +38,14 @@ case $1 in
|
||||
"reshim")
|
||||
reshim_command $callback_args;;
|
||||
|
||||
"source-add")
|
||||
source_add_command $callback_args;;
|
||||
"plugin-add")
|
||||
plugin_add_command $callback_args;;
|
||||
|
||||
"source-update")
|
||||
source_update_command $callback_args;;
|
||||
"plugin-update")
|
||||
plugin_update_command $callback_args;;
|
||||
|
||||
"source-remove")
|
||||
source_remove_command $callback_args;;
|
||||
"plugin-remove")
|
||||
plugin_remove_command $callback_args;;
|
||||
|
||||
*)
|
||||
help_command
|
||||
|
@ -6,7 +6,7 @@ package=$1
|
||||
executable_path=$2
|
||||
|
||||
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)
|
||||
|
||||
|
18
help.txt
18
help.txt
@ -1,16 +1,16 @@
|
||||
MANAGE PACKAGE SOURCES
|
||||
MANAGE PLUGINS
|
||||
|
||||
asdf source-add <name> <git-url>
|
||||
Add git repo as source for a package
|
||||
asdf plugin-add <name> <git-url>
|
||||
Add git repo as plugin
|
||||
|
||||
asdf source-remove <name>
|
||||
Remove package source and versions
|
||||
asdf plugin-remove <name>
|
||||
Remove plugin and versions
|
||||
|
||||
asdf source-update <name>
|
||||
Update package source
|
||||
asdf plugin-update <name>
|
||||
Update plugin
|
||||
|
||||
asdf source-updatee --all
|
||||
Update sources for all packages
|
||||
asdf plugin-updatee --all
|
||||
Update all plugins
|
||||
|
||||
|
||||
MANAGE PACKAGES
|
||||
|
@ -1,8 +1,8 @@
|
||||
install_command() {
|
||||
local package_name=$1
|
||||
local full_version=$2
|
||||
local source_path=$(get_source_path $package_name)
|
||||
check_if_source_exists $source_path
|
||||
local plugin_path=$(get_plugin_path $package_name)
|
||||
check_if_plugin_exists $plugin_path
|
||||
|
||||
IFS=':' read -a version_info <<< "$full_version"
|
||||
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
||||
@ -14,6 +14,6 @@ install_command() {
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
list_all_command() {
|
||||
local package_name=$1
|
||||
local source_path=$(get_source_path $package_name)
|
||||
check_if_source_exists $source_path
|
||||
local versions=$( ${source_path}/bin/list-all )
|
||||
local plugin_path=$(get_plugin_path $package_name)
|
||||
check_if_plugin_exists $plugin_path
|
||||
local versions=$( ${plugin_path}/bin/list-all )
|
||||
|
||||
IFS=' ' read -a versions_list <<< "$versions"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
list_command() {
|
||||
local package_name=$1
|
||||
local source_path=$(get_source_path $package_name)
|
||||
check_if_source_exists $source_path
|
||||
local plugin_path=$(get_plugin_path $package_name)
|
||||
check_if_plugin_exists $plugin_path
|
||||
|
||||
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
|
||||
if [ "$package_name" = "--all" ]; then
|
||||
for dir in $(asdf_dir)/sources/*; do
|
||||
(cd "$dir" && git pull)
|
||||
done
|
||||
else
|
||||
local source_path=$(get_source_path $package_name)
|
||||
check_if_source_exists $source_path
|
||||
(cd $source_path; git pull)
|
||||
local plugin_path=$(get_plugin_path $package_name)
|
||||
check_if_plugin_exists $plugin_path
|
||||
(cd $plugin_path; git pull)
|
||||
fi
|
||||
}
|
@ -2,8 +2,8 @@ reshim_command() {
|
||||
local package_name=$1
|
||||
local full_version=$2
|
||||
local executable_path=$3
|
||||
local source_path=$(get_source_path $package_name)
|
||||
check_if_source_exists $source_path
|
||||
local plugin_path=$(get_plugin_path $package_name)
|
||||
check_if_plugin_exists $plugin_path
|
||||
ensure_shims_dir
|
||||
|
||||
# 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 full_version=$2
|
||||
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"
|
||||
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
||||
@ -72,8 +72,8 @@ generate_shim_for_executable() {
|
||||
generate_shims_for_version() {
|
||||
local package_name=$1
|
||||
local full_version=$2
|
||||
local source_path=$(get_source_path $package_name)
|
||||
check_if_source_exists $source_path
|
||||
local plugin_path=$(get_plugin_path $package_name)
|
||||
check_if_plugin_exists $plugin_path
|
||||
|
||||
IFS=':' read -a version_info <<< "$full_version"
|
||||
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)
|
||||
|
||||
if [ -f ${source_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}")
|
||||
if [ -f ${plugin_path}/bin/list-bin-paths ]; then
|
||||
local space_seperated_list_of_bin_paths=$(sh ${plugin_path}/bin/list-bin-paths $package_name $install_type $version "${@:2}")
|
||||
else
|
||||
local space_seperated_list_of_bin_paths="bin"
|
||||
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() {
|
||||
local package_name=$1
|
||||
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"
|
||||
if [ "${version_info[0]}" = "tag" ] || [ "${version_info[0]}" = "commit" ]; then
|
||||
@ -21,8 +21,8 @@ uninstall_command() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f ${source_path}/bin/uninstall ]; then
|
||||
${source_path}/bin/uninstall $install_type $version $install_path "${@:3}"
|
||||
if [ -f ${plugin_path}/bin/uninstall ]; then
|
||||
${plugin_path}/bin/uninstall $install_type $version $install_path "${@:3}"
|
||||
else
|
||||
rm -rf $install_path
|
||||
fi
|
||||
|
@ -28,10 +28,10 @@ get_install_path() {
|
||||
}
|
||||
|
||||
|
||||
check_if_source_exists() {
|
||||
check_if_plugin_exists() {
|
||||
if [ ! -d $1 ]
|
||||
then
|
||||
display_error "No such package"
|
||||
display_error "No such plugin"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@ -43,8 +43,8 @@ get_version_part() {
|
||||
}
|
||||
|
||||
|
||||
get_source_path() {
|
||||
echo $(asdf_dir)/sources/$1
|
||||
get_plugin_path() {
|
||||
echo $(asdf_dir)/plugins/$1
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user