Fix installs; list command working

This commit is contained in:
Akash Manohar J 2014-12-13 21:56:56 +05:30
parent f71e7b6e0b
commit e8806caf61
2 changed files with 28 additions and 15 deletions

View File

@ -36,7 +36,7 @@ install_command() {
local version="${version_info[0]}"
fi
local install_path=$(get_install_path $package $full_version)
local install_path=$(get_install_path $package $install_type $version)
${source_path}/bin/install $install_type $version $install_path "${@:3}"
}
@ -63,20 +63,11 @@ uninstall_command() {
local version="${version_info[0]}"
fi
local install_path=$(get_install_path $package $full_version)
local install_path=$(get_install_path $package $install_type $version)
${source_path}/bin/uninstall $install_type $version $install_path "${@:3}"
}
get_install_path() {
local package=$1
local version=$2
mkdir -p $(asdf_dir)/installs/${package}
echo $(asdf_dir)/installs/${package}/${version}
}
list_all_command() {
local source_path=$(get_source_path $1)
check_if_source_exists $source_path
@ -87,10 +78,7 @@ list_all_command() {
list_command() {
local source_path=$(get_source_path $1)
check_if_source_exists $source_path
echo "TODO"
# echo ./$(asdf_dir)/sources/$1/list
#TODO list versions installed with the installs/erlang/.installs file
# the .installs file will have lines of the format "version hash"
list_package_installs $1
}

View File

@ -22,6 +22,31 @@ run_callback_if_command() {
}
list_package_installs() {
local package=$1
local package_installs_path=$(asdf_dir)/installs/${package}
if [ -d $package_installs_path ]
then
for install in ${package_installs_path}/*/; do
echo "$(basename $install)"
done
else
echo 'Oohes nooes ~! Nothing found'
fi
}
get_install_path() {
local package=$1
local install_type=$2
local version=$3
mkdir -p $(asdf_dir)/installs/${package}
echo $(asdf_dir)/installs/${package}/${install_type}-${version}
}
check_if_source_exists() {
if [ ! -d $1 ]
then