forked from e621ng/e621ng

This just makes sense, and was confusing beforehand. Case-in-point: Two test classes for pools: pool_versions and pool_archive
45 lines
1.4 KiB
Ruby
Executable File
45 lines
1.4 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
require 'fileutils'
|
|
|
|
# path to your application root.
|
|
APP_ROOT = File.expand_path('..', __dir__)
|
|
|
|
def system!(*args)
|
|
system(*args) || abort("\n== Command #{args} failed ==")
|
|
end
|
|
|
|
FileUtils.chdir APP_ROOT do
|
|
# This script is a way to setup or update your development environment automatically.
|
|
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
|
# Add necessary setup steps to this file.
|
|
|
|
puts '== Installing dependencies =='
|
|
system('bundle check') || system!('bundle install -j$(nproc)')
|
|
|
|
# Install JavaScript dependencies
|
|
system('bin/yarn')
|
|
|
|
puts "\n== Copying sample files =="
|
|
unless File.exist?('config/database.yml')
|
|
FileUtils.cp 'docker/database.yml', 'config/database.yml'
|
|
end
|
|
unless File.exist?('config/danbooru_local_config.rb')
|
|
FileUtils.cp 'docker/danbooru_local_config.rb', 'config/danbooru_local_config.rb'
|
|
end
|
|
|
|
puts "\n== Preparing database =="
|
|
system! 'bin/rails db:prepare'
|
|
|
|
puts "\n== Preparing search indices =="
|
|
system! 'bin/rails r Post.__elasticsearch__.create_index!'
|
|
system! 'bin/rails r Post.import'
|
|
system! 'bin/rails r PostVersion.__elasticsearch__.create_index!'
|
|
system! 'bin/rails r PostVersion.import'
|
|
|
|
puts "\n== Removing old logs and tempfiles =="
|
|
system! 'bin/rails log:clear tmp:clear'
|
|
|
|
puts "\n== Restarting application server =="
|
|
system! 'bin/rails restart'
|
|
end
|