ministryofjustice/atet

View on GitHub
bin/run_full_system

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby
require "fileutils"
 
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
 
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
 
FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your full system environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
 
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end
 
if ENV.fetch('RAILS_ENV', 'development') == 'development'
puts "\n== bundling for development"
system! 'bundle install'
 
puts "\n== Running yarn install"
system! 'yarn install'
end
 
 
puts "\n== Preparing database =="
system! 'DISABLE_ADMIN=true bin/rails db:create db:migrate db:seed'
 
puts "\n== Starting app and sidekiq =="
system! "cd #{APP_ROOT} && invoker start"
end