minor install script improvements

This commit is contained in:
Florian Staudacher 2012-10-02 10:45:03 +02:00
parent 5b73176d07
commit 599d2e9aae

View file

@ -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 D_GIT_CLONE_PATH="/srv/diaspora" # path for diaspora
@ -54,7 +61,8 @@ D_DB_USER="diaspora"
D_DB_PASS="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 #### #### INTERNAL VARS ####
@ -125,11 +133,11 @@ interactive_check() {
# check if all necessary binaries are available # check if all necessary binaries are available
binaries_check() { binaries_check() {
for exe in $BINARIES; do for exe in "${!BINARIES[@]}"; do
echo -n "checking for $exe... " echo -n "checking for $exe... "
which "$exe" which "${BINARIES[$exe]}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
error "you are missing $exe"; error "you are missing the '${BINARIES[$exe]}' command, please install '$exe'";
fi fi
done done
echo "" echo ""
@ -190,7 +198,7 @@ install_or_use_ruby() {
# trust and load rvmrc # trust and load rvmrc
# do this in a directory that has a .rvmrc, only :) # do this in a directory that has a .rvmrc, only :)
load_rvmrc() { load_rvmrc() {
if ! $RVM_DETECTED ; then if ! $RVM_DETECTED || [[ ! -s ".rvmrc" ]] ; then
return return
fi fi
@ -202,7 +210,7 @@ load_rvmrc() {
# load .rvmrc # load .rvmrc
echo -n "loading .rvmrc ... " echo -n "loading .rvmrc ... "
source .rvmrc source ".rvmrc"
#rvm rvmrc load #rvm rvmrc load
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
echo "ok" echo "ok"
@ -247,13 +255,13 @@ js_runtime_check() {
fi fi
# TheRubyRacer # TheRubyRacer
gem which v8 >/dev/null 2>&1 (echo "require 'v8'" | ruby) >/dev/null 2>&1
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
JS_RUNTIME_DETECTED=true JS_RUNTIME_DETECTED=true
fi fi
## ##
# add your favourite js runtime here... # add a check for your favourite js runtime here...
## ##
if $JS_RUNTIME_DETECTED ; then 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" run_or_error "bundle exec rake db:schema:load_if_ruby db:structure:load_if_sql --trace"
echo "" echo ""
define GOODBYE_MSG <<'EOT' define GOODBYE_MSG <<EOT
##################################################################### #####################################################################
It worked! :) It worked! :)
@ -431,11 +439,12 @@ start Diaspora* in development mode with:
`rails s` `rails s`
For further information read the wiki at $D_WIKI_URL
or join us on IRC $D_IRC_URL
EOT EOT
echo "$GOODBYE_MSG" echo "$GOODBYE_MSG"
echo "For further information read the wiki at $D_WIKI_URL"
echo "or join us on IRC $D_IRC_URL"
echo ""
exit 0 exit 0