forked from e621ng/e621ng
36 lines
1.2 KiB
Ruby
Executable File
36 lines
1.2 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 "\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! 'DANBOORU_DISABLE_THROTTLES=true 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'
|
|
end
|