Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / apps / workbench / bin / setup
1 #!/usr/bin/env ruby
2 # Copyright (C) The Arvados Authors. All rights reserved.
3 #
4 # SPDX-License-Identifier: AGPL-3.0
5
6 require 'fileutils'
7 include FileUtils
8
9 # path to your application root.
10 APP_ROOT = File.expand_path('..', __dir__)
11
12 def system!(*args)
13   system(*args) || abort("\n== Command #{args} failed ==")
14 end
15
16 chdir APP_ROOT do
17   # This script is a starting point to setup your application.
18   # Add necessary setup steps to this file.
19
20   puts '== Installing dependencies =='
21   system! 'gem install bundler --conservative'
22   system('bundle check') || system!('bundle install')
23
24   # Install JavaScript dependencies if using Yarn
25   # system('bin/yarn')
26
27   # puts "\n== Copying sample files =="
28   # unless File.exist?('config/database.yml')
29   #   cp 'config/database.yml.sample', 'config/database.yml'
30   # end
31
32   puts "\n== Preparing database =="
33   system! 'bin/rails db:setup'
34
35   puts "\n== Removing old logs and tempfiles =="
36   system! 'bin/rails log:clear tmp:clear'
37
38   puts "\n== Restarting application server =="
39   system! 'bin/rails restart'
40 end