internetee-registry/bin/setup
Artur Beljajev fa52001be6 Upgrade to Rails 5.0
Closes #377
2019-11-15 15:26:33 +02:00

33 lines
855 B
Ruby
Executable file

#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
Dir.chdir APP_ROOT do
puts '== Installing dependencies with bundler =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "\n== Copying sample development database config files =="
unless File.exist?('config/database.yml')
system! 'cp config/database-example-development.yml config/database.yml'
end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rake log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'touch tmp/restart.txt'
end