Permalink
Browse files

some directories can be replaced instead of manually coping files, up…

…date #2634
  • Loading branch information...
mpapis committed Feb 25, 2014
1 parent 1292843 commit ad5e6a8d93b0df42b6eb6d82fcb66abb4080684a
Showing with 33 additions and 28 deletions.
  1. +33 −28 scripts/functions/installer
@@ -432,36 +432,41 @@ install_rvm_files()
__rvm_cp -f "$source_path/${file}" "$rvm_path/${file}"
done
- for directory in config contrib scripts examples lib help docs patches gem-cache
+ for entry in contrib examples lib help docs
do
- for entry in $(__rvm_find $directory 2>/dev/null)
- do
- if
- [[ -f "$source_path/$entry" ]] &&
- [[ "$entry" == "scripts/extras/completion.zsh/_rvm" || "$entry" == "scripts/zsh/Completion/_rvm" ]]
- then
- if __rvm_rm_rf "$rvm_path/$entry" 2>/dev/null
- then __rvm_cp -f "$source_path/$entry" "$rvm_path/$entry"
- else rvm_log " Can not update '$entry', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file."
- fi
- elif
- [[ -f "$source_path/$entry" ]]
- then
- # Target is supposed to be a file, remove if it is a directory.
- if [[ -d "$rvm_path/$entry" ]]
- then __rvm_rm_rf "$rvm_path/$entry"
- fi
- __rvm_cp -f "$source_path/$entry" "$rvm_path/$entry"
- elif
- [[ -d "$source_path/$entry" ]]
- then
- # Target is supposed to be a directory, remove if it is a file.
- if [[ -f "$rvm_path/$entry" ]]
- then \rm -f "$rvm_path/$entry"
- fi
- [[ -d "$rvm_path/$entry" ]] || mkdir -p "$rvm_path/$entry"
+ if [[ -e "$rvm_path/$entry" ]]
+ then __rvm_rm_rf "$rvm_path/$entry"
+ fi
+ __rvm_cp -rf "$source_path/$entry" "$rvm_path/$entry"
+ done
+
+ for entry in $(__rvm_find config scripts patches gem-cache 2>/dev/null)
+ do
+ if
+ [[ -f "$source_path/$entry" ]] &&
+ [[ "$entry" == "scripts/extras/completion.zsh/_rvm" || "$entry" == "scripts/zsh/Completion/_rvm" ]]
+ then
+ if __rvm_rm_rf "$rvm_path/$entry" 2>/dev/null
+ then __rvm_cp -f "$source_path/$entry" "$rvm_path/$entry"
+ else rvm_log " Can not update '$entry', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file."
fi
- done
+ elif
+ [[ -f "$source_path/$entry" ]]
+ then
+ # Target is supposed to be a file, remove if it is a directory.
+ if [[ -d "$rvm_path/$entry" ]]
+ then __rvm_rm_rf "$rvm_path/$entry"
+ fi
+ __rvm_cp -f "$source_path/$entry" "$rvm_path/$entry"
+ elif
+ [[ -d "$source_path/$entry" ]]
+ then
+ # Target is supposed to be a directory, remove if it is a file.
+ if [[ -f "$rvm_path/$entry" ]]
+ then \rm -f "$rvm_path/$entry"
+ fi
+ [[ -d "$rvm_path/$entry" ]] || mkdir -p "$rvm_path/$entry"
+ fi
done
true # for osx
}

0 comments on commit ad5e6a8

Please sign in to comment.