Skip to content

Commit

Permalink
ci script for ensemble
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Burkhart & Thom Mahoney committed Nov 8, 2011
1 parent a4505bf commit 29a2017
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions script/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -x
set -e
export LANG=en_US.UTF-8

db_host=$DB_HOST
db_user=$USER
db_pass=$DB_PASS
db_name=ensemble_ci_$$
internal_key="/home/$USER/.ssh/internal"

db_create_command="createdb -U postgres -h localhost -O $db_user $db_name"
db_drop_command="dropdb -U postgres -h localhost $db_name"
db_remote_command="ssh -F /dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i $internal_key root@$db_host"

if [[ $db_host == "localhost" ]]; then
sudo -u postgres $db_create_command
trap "echo 'database cleanup'; sudo -u postgres ${db_drop_command}" EXIT
else
$db_remote_command $db_create_command
trap "echo 'database cleanup'; ${db_remote_command} ${db_drop_command}" EXIT
fi

test -d config && {
cat > config/database.yml <<EOF
test:
adapter: postgresql
user: $db_user
host: $db_host
database: $db_name
password: $db_pass
EOF
}

source use_ruby.sh
use_ruby 1.9.2

test -f Gemfile
gem install bundler --no-rdoc --no-ri
bundle

bundle exec rake db:migrate
time bundle exec rake --trace

0 comments on commit 29a2017

Please sign in to comment.