asdf/lib/commands/install.sh

30 lines
806 B
Bash
Raw Normal View History

2015-05-17 01:49:28 -07:00
install_command() {
2015-05-17 00:46:56 -07:00
local package_name=$1
local full_version=$2
2015-05-17 11:20:51 -07:00
local plugin_path=$(get_plugin_path $package_name)
check_if_plugin_exists $plugin_path
2015-05-07 22:58:07 -07:00
2015-05-17 00:46:56 -07:00
IFS=':' read -a version_info <<< "$full_version"
2015-05-21 21:47:27 -07:00
if [ "${version_info[0]}" = "ref" ]; then
2015-05-17 00:46:56 -07:00
local install_type="${version_info[0]}"
local version="${version_info[1]}"
else
local install_type="version"
local version="${version_info[0]}"
fi
2015-05-07 22:58:07 -07:00
2015-05-17 00:46:56 -07:00
local install_path=$(get_install_path $package_name $install_type $version)
2015-05-21 22:17:44 -07:00
(
export ASDF_INSTALL_TYPE=$install_type
export ASDF_INSTALL_VERSION=$version
export ASDF_INSTALL_PATH=$install_path
bash ${plugin_path}/bin/install
)
local exit_code=$?
if [ $exit_code -eq 0 ]; then
reshim_command $package_name $full_version
else
exit $exit_code
fi
2015-05-17 00:46:56 -07:00
}