diff --git a/script/install.sh b/script/install.sh index 98aaa4ab6..b5fde734c 100755 --- a/script/install.sh +++ b/script/install.sh @@ -32,7 +32,14 @@ other ideas what we could do # # #### #### -BINARIES="git ruby gem bundle sed mktemp" # required programs +# required programs +declare -A BINARIES +BINARIES["git"]="git" +BINARIES["ruby"]="ruby" +BINARIES["rubygems"]="gem" +BINARIES["bundler"]="bundle" +BINARIES["sed"]="sed" +BINARIES["mktemp"]="mktemp" D_GIT_CLONE_PATH="/srv/diaspora" # path for diaspora @@ -54,7 +61,8 @@ D_DB_USER="diaspora" D_DB_PASS="diaspora" -D_RUBY_VERSION="1.9.3-p125" +# TODO: read this from ./script/env/ruby_env +D_RUBY_VERSION="1.9.3-p194" #### INTERNAL VARS #### @@ -125,11 +133,11 @@ interactive_check() { # check if all necessary binaries are available binaries_check() { - for exe in $BINARIES; do + for exe in "${!BINARIES[@]}"; do echo -n "checking for $exe... " - which "$exe" + which "${BINARIES[$exe]}" if [ $? -ne 0 ]; then - error "you are missing $exe"; + error "you are missing the '${BINARIES[$exe]}' command, please install '$exe'"; fi done echo "" @@ -190,7 +198,7 @@ install_or_use_ruby() { # trust and load rvmrc # do this in a directory that has a .rvmrc, only :) load_rvmrc() { - if ! $RVM_DETECTED ; then + if ! $RVM_DETECTED || [[ ! -s ".rvmrc" ]] ; then return fi @@ -202,7 +210,7 @@ load_rvmrc() { # load .rvmrc echo -n "loading .rvmrc ... " - source .rvmrc + source ".rvmrc" #rvm rvmrc load if [ $? -eq 0 ] ; then echo "ok" @@ -247,13 +255,13 @@ js_runtime_check() { fi # TheRubyRacer - gem which v8 >/dev/null 2>&1 + (echo "require 'v8'" | ruby) >/dev/null 2>&1 if [ $? -eq 0 ] ; then JS_RUNTIME_DETECTED=true fi ## - # add your favourite js runtime here... + # add a check for your favourite js runtime here... ## if $JS_RUNTIME_DETECTED ; then @@ -416,7 +424,7 @@ echo "creating the default database specified in config/database.yml. please wai run_or_error "bundle exec rake db:schema:load_if_ruby db:structure:load_if_sql --trace" echo "" -define GOODBYE_MSG <<'EOT' +define GOODBYE_MSG <