1
0
Fork 0
This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/script/setup

41 lines
911 B
Plaintext
Raw Normal View History

2019-04-27 12:13:37 +00:00
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'fileutils'
APP_ROOT = File.expand_path('..', __dir__).freeze
def system!(*args)
system(*args) or abort "\n== Command #{args} failed =="
end
initial = !!ARGV.delete('--initial')
FileUtils.chdir APP_ROOT do
puts '== Update RubyGems =='
system! 'gem update --system'
puts '== Update Bundler =='
system! "gem install bundler -v '~> 2.0'"
puts '== Installing gems =='
system 'bundle check' or system! 'bundle install'
puts '== Install JavaScript dependencies =='
system! 'bin/rake yarn:install'
if initial
puts '== Preparing database =='
system! 'bin/rails db:setup'
else
puts '== Updating database =='
system! 'bin/rails db:migrate'
end
puts '== Removing old logs and tempfiles =='
system! 'bin/rails log:clear tmp:clear'
puts '== Restarting application server =='
system! 'bin/rails restart'
end