setup 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env ruby
  2. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  3. require 'fileutils'
  4. # path to your application root.
  5. APP_ROOT = File.expand_path('..', __dir__)
  6. def system!(*args)
  7. system(*args) || abort("\n== Command #{args} failed ==")
  8. end
  9. FileUtils.chdir APP_ROOT do
  10. # This script is a way to setup or update your development environment automatically.
  11. # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
  12. # Add necessary setup steps to this file.
  13. puts '== Installing dependencies =='
  14. system! 'gem install bundler --conservative'
  15. system('bundle check') || system!('bundle install')
  16. # Install JavaScript dependencies
  17. # system('bin/yarn')
  18. # puts "\n== Copying sample files =="
  19. # unless File.exist?('config/database.yml')
  20. # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
  21. # end
  22. puts "\n== Preparing database =="
  23. system! 'bin/rails db:prepare'
  24. puts "\n== Removing old logs and tempfiles =="
  25. system! 'bin/rails log:clear tmp:clear'
  26. puts "\n== Restarting application server =="
  27. system! 'bin/rails restart'
  28. end