bin/setup
#!/usr/bin/env ruby
require "fileutils"
include FileUtils
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")
system("bin/yarn")
puts "\n== Preparing database =="
system! "bundle exec rails db:create db:structure:load"
system! "bundle exec rails db:test:prepare"
system! "bundle exec rails db:seed"
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
end