if [ condition ]; then

This commit is contained in:
Akash Manohar J 2015-05-17 16:17:45 +05:30
parent ab04ca9f55
commit 78c2c9b3fc
7 changed files with 16 additions and 27 deletions

View File

@ -10,16 +10,14 @@ check_if_source_exists $source_path
full_version=$(get_preset_version_for $package)
if [ "$full_version" == "" ]
then
if [ "$full_version" == "" ]; then
echo "No version set for ${package}"
exit -1
fi
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
install_type="${version_info[0]}"
version="${version_info[1]}"
else
@ -29,8 +27,7 @@ fi
install_path=$(get_install_path $package $install_type $version)
if [ -f ${source_path}/bin/exec-env ]
then
if [ -f ${source_path}/bin/exec-env ]; then
exec_env=$(${source_path}/bin/exec-env $install_type $version $install_path)
(
eval export ${exec_env};

View File

@ -5,8 +5,7 @@ install_command() {
check_if_source_exists $source_path
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
local install_type="${version_info[0]}"
local version="${version_info[1]}"
else

View File

@ -5,8 +5,7 @@ list_command() {
local package_installs_path=$(asdf_dir)/installs/${package_name}
if [ -d $package_installs_path ]
then
if [ -d $package_installs_path ]; then
#TODO check if dir is empty and show no-installed-versions msg
for install in ${package_installs_path}/*/; do
echo "$(basename $install)"

View File

@ -6,8 +6,7 @@ reshim_command() {
ensure_shims_dir
# If full version is empty then generate shims for all versions in the package
if [ $full_version = "" ]
then
if [ $full_version = "" ]; then
for install in ${package_installs_path}/*/; do
local full_version_name=$(echo $(basename $install) | sed 's/tag\-/tag\:/' | sed 's/commit-/commit:/')
generate_shims_for_version $package_name $full_version_name
@ -20,8 +19,7 @@ reshim_command() {
ensure_shims_dir() {
# Create shims dir if doesn't exist
if [ ! -d $(asdf_dir)/shims ]
then
if [ ! -d $(asdf_dir)/shims ]; then
mkdir $(asdf_dir)/shims
fi
}
@ -48,8 +46,7 @@ generate_shims_for_version() {
check_if_source_exists $source_path
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
local install_type="${version_info[0]}"
local version="${version_info[1]}"
else

View File

@ -5,8 +5,7 @@ source_add_command() {
mkdir -p $(asdf_dir)/sources
git clone $source_url $source_path
if [ $? -eq 0 ]
then
if [ $? -eq 0 ]; then
chmod +x $source_path/bin/*
fi
}

View File

@ -1,8 +1,9 @@
source_update_command() {
local package_name=$1
if [ "$package_name" = "--all" ]
then
for dir in $(asdf_dir)/sources/*; do (cd "$dir" && git pull); done
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

View File

@ -6,8 +6,7 @@ uninstall_command() {
check_if_source_exists $source_path
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
local install_type="${version_info[0]}"
local version="${version_info[1]}"
else
@ -17,14 +16,12 @@ uninstall_command() {
local install_path=$(get_install_path $package_name $install_type $version)
if [ ! -d $install_path ]
then
if [ ! -d $install_path ]; then
display_error "No such version"
exit 1
fi
if [ -f ${source_path}/bin/uninstall ]
then
if [ -f ${source_path}/bin/uninstall ]; then
${source_path}/bin/uninstall $install_type $version $install_path "${@:3}"
else
rm -rf $install_path