You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastodon/bin/setup

36 lines
946 B
Plaintext

9 years ago
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
9 years ago
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
9 years ago
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
9 years ago
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
9 years ago
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
system!('yarn install')
9 years ago
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
9 years ago
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
9 years ago
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
9 years ago
puts "\n== Restarting application server =="
system! 'bin/rails restart'
9 years ago
end