forked from e621ng/e621ng
33 lines
1.2 KiB
Ruby
Executable File
33 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, exception: true)
|
|
end
|
|
|
|
FileUtils.chdir APP_ROOT do
|
|
# This script is a way to set up or update your development environment automatically.
|
|
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
|
# Add necessary setup steps to this file.
|
|
|
|
puts "\n== Copying sample files =="
|
|
unless File.exist?('config/danbooru_local_config.rb')
|
|
FileUtils.cp 'docker/danbooru_local_config.rb', 'config/danbooru_local_config.rb'
|
|
end
|
|
|
|
puts "== Creating opensearch indices ==\n"
|
|
system! "RAILS_ENV=development bin/rails runner '[Post, PostVersion].each { |model| model.document_store.create_index! }'"
|
|
|
|
puts "\n== Preparing database =="
|
|
# Create the test database, since only development exists at this point
|
|
system! 'RAILS_ENV=test bin/rails db:create'
|
|
system! 'RAILS_ENV=development bin/rails db:schema:load'
|
|
system! 'RAILS_ENV=development DANBOORU_DISABLE_THROTTLES=true bin/rails db:seed'
|
|
|
|
puts "\n== Removing old logs and tempfiles =="
|
|
system! 'bin/rails log:clear tmp:clear'
|
|
end
|