update 782 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env ruby
  2. require 'pathname'
  3. require 'fileutils'
  4. include FileUtils
  5. # path to your application root.
  6. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
  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. puts "\n== Updating database =="
  17. system! 'bin/rails db:migrate'
  18. puts "\n== Removing old logs and tempfiles =="
  19. system! 'bin/rails log:clear tmp:clear'
  20. puts "\n== Restarting application server =="
  21. system! 'bin/rails restart'
  22. end