update 931 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env ruby
  2. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  3. require 'fileutils'
  4. include FileUtils # rubocop:disable Style/MixinUsage
  5. # path to your application root.
  6. APP_ROOT = File.expand_path('..', __dir__)
  7. def system!(*args)
  8. system(*args) || abort("\n== Command #{args} failed ==")
  9. end
  10. chdir APP_ROOT do
  11. # This script is a way to update your development environment automatically.
  12. # Add necessary update 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 if using Yarn
  17. # system('bin/yarn')
  18. puts "\n== Updating database =="
  19. system! 'bin/rails db:migrate'
  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