#!/bin/bash -x
source '/usr/local/lib/rvm'
bundle install --path "/home/jenkins/bundles/${JOB_NAME}" --deployment --without mac_development

echo -e "SOLR_HOST='localhost'\nDIRECTGOV_JOBS_API_AUTHENTICATION_KEY='TESTING'" >> /var/lib/jenkins/jobs/Jobs/workspace/config/initializers/config.rb

bundle exec rake db:setup
bundle exec rake db:migrate
bundle exec rake stats

# DELETE STATIC SYMLINKS AND RECONNECT...
rm /var/lib/jenkins/jobs/Jobs/workspace/public/images
rm /var/lib/jenkins/jobs/Jobs/workspace/public/javascripts
rm /var/lib/jenkins/jobs/Jobs/workspace/public/templates
rm /var/lib/jenkins/jobs/Jobs/workspace/public/stylesheets

ln -s /var/lib/jenkins/jobs/Static/workspace/public/images /var/lib/jenkins/jobs/Jobs/workspace/public/images
ln -s /var/lib/jenkins/jobs/Static/workspace/public/javascripts /var/lib/jenkins/jobs/Jobs/workspace/public/javascripts
ln -s /var/lib/jenkins/jobs/Static/workspace/public/templates /var/lib/jenkins/jobs/Jobs/workspace/public/templates
ln -s /var/lib/jenkins/jobs/Static/workspace/public/stylesheets /var/lib/jenkins/jobs/Jobs/workspace/public/stylesheets

bundle exec rake ci:setup:testunit test:units test:functionals
RESULT=$?
exit $RESULT

#!/bin/bash -x
bundle install --path "${HOME}/bundles/${JOB_NAME}" --deployment --without mac_development

echo -e "SOLR_HOST='localhost'\nDIRECTGOV_JOBS_API_AUTHENTICATION_KEY='TESTING'" >> config/initializers/config.rb

bundle exec rake db:setup
bundle exec rake db:migrate
bundle exec rake stats

# DELETE STATIC SYMLINKS AND RECONNECT...
for d in images javascripts templates stylesheets; do
  rm -f public/$d
  ln -s ../../../Static/workspace/public/$d public/
done

bundle exec rake ci:setup:testunit test:units test:functionals
RESULT=$?
exit $RESULT

Remove RVM from build script.
Remove RVM from build script.
