15964: Remove qr1hi from a few more places. Delete unused includes.
[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 'pathname'
7 require 'fileutils'
8 include FileUtils
9
10 # path to your application root.
11 APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
12
13 def system!(*args)
14   system(*args) || abort("\n== Command #{args} failed ==")
15 end
16
17 chdir APP_ROOT do
18   # This script is a starting point to setup your application.
19   # Add necessary setup steps to this file.
20
21   puts '== Installing dependencies =='
22   system! 'gem install bundler --conservative'
23   system('bundle check') || system!('bundle install')
24
25   # puts "\n== Copying sample files =="
26   # unless File.exist?('config/database.yml')
27   #   cp 'config/database.yml.sample', 'config/database.yml'
28   # end
29
30   puts "\n== Preparing database =="
31   system! 'bin/rails db:setup'
32
33   puts "\n== Removing old logs and tempfiles =="
34   system! 'bin/rails log:clear tmp:clear'
35
36   puts "\n== Restarting application server =="
37   system! 'bin/rails restart'
38 end