setup 939 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env ruby
  2. require "fileutils"
  3. # path to your application root.
  4. APP_ROOT = File.expand_path('..', __dir__)
  5. def system!(*args)
  6. system(*args, exception: true)
  7. end
  8. FileUtils.chdir APP_ROOT do
  9. # This script is a way to set up or update your development environment automatically.
  10. # This script is idempotent, so that you can run it at any time and get an expectable outcome.
  11. # Add necessary setup steps to this file.
  12. puts "\n== Installing Ruby dependencies =="
  13. system! 'gem install bundler --conservative'
  14. system('bundle check') || system!('bundle install')
  15. puts "\n== Installing JS dependencies =="
  16. system! 'corepack enable'
  17. system! 'bin/yarn install --immutable'
  18. puts "\n== Preparing database =="
  19. system! 'bin/rails db:prepare'
  20. puts "\n== Removing old logs and tempfiles =="
  21. system! 'bin/rails log:clear tmp:clear'
  22. puts "\n== Restarting application server =="
  23. system! 'bin/rails restart'
  24. end