internetee-registry/bin/setup
Georg 6fb8767aef
Improve setup and seed (#1352)
bin/setup.deps for installing dependencies before running setup
rework bin/setup for initial setup
improved db:seed
2019-10-31 00:15:36 +02:00

32 lines
851 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/rake db:setup'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end