You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
946 B

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  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 starting point to setup your application.
  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. system!('yarn install')
  17. # puts "\n== Copying sample files =="
  18. # unless File.exist?('config/database.yml')
  19. # cp 'config/database.yml.sample', 'config/database.yml'
  20. # end
  21. puts "\n== Preparing database =="
  22. system! 'bin/rails db:setup'
  23. puts "\n== Removing old logs and tempfiles =="
  24. system! 'bin/rails log:clear tmp:clear'
  25. puts "\n== Restarting application server =="
  26. system! 'bin/rails restart'
  27. end