#!/usr/bin/env ruby require 'pathname' require 'fileutils' # path to your application root. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end Dir.chdir APP_ROOT do puts '== Installing dependencies with bundler ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') puts "\n== Copying sample development database config files ==" unless File.exist?('config/database.yml') system! 'cp config/database-example-development.yml config/database.yml' end puts "\n== Preparing database ==" system! 'bin/rake db:setup' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rake log:clear tmp:clear' puts "\n== Restarting application server ==" system! 'touch tmp/restart.txt' end