4 APP_ROOT = File.expand_path("..", __dir__)
 
   7   system(*, :exception => true)
 
  10 FileUtils.chdir APP_ROOT do
 
  11   # This script is a way to set up or update your development environment automatically.
 
  12   # This script is idempotent, so that you can run it at any time and get an expectable outcome.
 
  13   # Add necessary setup steps to this file.
 
  15   puts "== Installing dependencies =="
 
  16   system("bundle check") || system!("bundle install")
 
  18   # puts "\n== Copying sample files =="
 
  19   # unless File.exist?("config/database.yml")
 
  20   #   FileUtils.cp "config/database.yml.sample", "config/database.yml"
 
  23   puts "\n== Preparing database =="
 
  24   system! "bin/rails db:prepare"
 
  26   puts "\n== Removing old logs and tempfiles =="
 
  27   system! "bin/rails log:clear tmp:clear"
 
  29   unless ARGV.include?("--skip-server")
 
  30     puts "\n== Starting development server =="
 
  31     $stdout.flush # flush the output before exec(2) so that it displays