updated ruby_gem_install_if_absent.sh

pull/2/head
Hari Sekhon 5 years ago
parent 64c8e3a747
commit 8f65f6c523

@ -32,29 +32,40 @@ usage(){
exit 3 exit 3
} }
for arg; do
case "$arg" in
-*) usage
;;
esac
done
gems="" gems=""
for x in "$@"; do
if [ -f "$x" ]; then process_args(){
echo "adding gems from file: $x" for arg; do
gems="$gems $(sed 's/#.*//;/^[[:space:]]*$$/d' "$x")" if [ -f "$arg" ]; then
echo "adding gems from file: $arg"
gems="$gems $(sed 's/#.*//;/^[[:space:]]*$$/d' "$arg")"
echo echo
else else
gems="$gems $x" gems="$gems $arg"
fi fi
gems="$(tr ' ' ' \n' <<< "$gems" | sort -u | tr '\n' ' ')"
done done
}
for x in "$@"; do if [ -n "${*:-}" ]; then
case "$1" in process_args "$@"
-*) usage else
;; # shellcheck disable=SC2046
esac process_args $(cat)
done fi
if [ -z "$gems" ]; then if [ -z "$gems" ]; then
usage usage
fi fi
gems="$(tr ' ' ' \n' <<< "$gems" | sort -u | tr '\n' ' ')"
echo "Installing Ruby Gems that are not already installed" echo "Installing Ruby Gems that are not already installed"
echo echo

Loading…
Cancel
Save