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