From b1995f76660d75bebf57ca3540870b0d09367309 Mon Sep 17 00:00:00 2001 From: Nathan Wilson Date: Thu, 16 Oct 2014 17:19:18 +0000 Subject: [PATCH] Fixed Ruby version in various script/* --- script/run_rake | 3 ++- script/run_script | 3 ++- script/run_tests | 5 +++-- script/unicorn | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/script/run_rake b/script/run_rake index fd8fa14064..42a333d0cd 100755 --- a/script/run_rake +++ b/script/run_rake @@ -1,6 +1,7 @@ #!/bin/bash -source $(ls /usr/local/rvm/environments/ruby-1.9.3-p* | grep -v @ | tail -1) +ruby_version=$(cat /var/web/mushroom-observer/.ruby-version) +source /usr/local/rvm/environments/ruby-$ruby_version rake $* -f /var/web/mushroom-observer/Rakefile | \ grep -v '(in /home/' | grep -v '^\*\* ' diff --git a/script/run_script b/script/run_script index 67b265cfe1..f327fa2ccf 100755 --- a/script/run_script +++ b/script/run_script @@ -1,6 +1,7 @@ #!/bin/bash -source $(ls /usr/local/rvm/environments/ruby-1.9.3-p* | grep -v @ | tail -1) +ruby_version=$(cat /var/web/mushroom-observer/.ruby-version) +source /usr/local/rvm/environments/ruby-$ruby_version dir=$(dirname "$0") if [[ $2 == '-v' ]]; then diff --git a/script/run_tests b/script/run_tests index 9dccb74aef..242d2b04dc 100755 --- a/script/run_tests +++ b/script/run_tests @@ -3,9 +3,10 @@ if [[ $RAKE_TEST_LOADER != '' ]]; then loader=$RAKE_TEST_LOADER elif [[ $MY_RUBY_HOME != '' ]]; then - loader=$MY_RUBY_HOME/lib/ruby/1.9.1/rake/rake_test_loader.rb + loader=$(ls $MY_RUBY_HOME/lib/ruby/*/rake/rake_test_loader.rb | tail -1) else - loader=/usr/local/lib/ruby/1.9.3/rake/rake_test_loader.rb + ruby_version=$(cat /var/web/mushroom-observer/.ruby-version) + loader=/usr/local/lib/ruby/$ruby_version/rake/rake_test_loader.rb fi ruby -Ilib:test $loader test/{unit,functional,integration}/*_test.rb diff --git a/script/unicorn b/script/unicorn index d23f95d85d..ebe20847eb 100755 --- a/script/unicorn +++ b/script/unicorn @@ -28,7 +28,8 @@ start) else echo "Starting unicorn..." cd $app_root - rvm_env=$(ls /usr/local/rvm/environments/ruby-1.9.3-p* | grep -v @ | tail -1) + ruby_version=$(cat /var/web/mushroom-observer/.ruby-version) + rvm_env=/usr/local/rvm/environments/ruby-$ruby_version start_cmd="source $rvm_env && bundle exec unicorn_rails -c $conf_file -D" case `whoami` in mo)