15964: Remove qr1hi from a few more places. Delete unused includes.
[arvados.git] / services / api / bin / update
1 #!/usr/bin/env ruby
2
3 # Copyright (C) The Arvados Authors. All rights reserved.
4 #
5 # SPDX-License-Identifier: AGPL-3.0
6
7 require 'pathname'
8 require 'fileutils'
9 include FileUtils
10
11 # path to your application root.
12 APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
13
14 def system!(*args)
15   system(*args) || abort("\n== Command #{args} failed ==")
16 end
17
18 chdir APP_ROOT do
19   # This script is a way to update your development environment automatically.
20   # Add necessary update steps to this file.
21
22   puts '== Installing dependencies =='
23   system! 'gem install bundler --conservative'
24   system('bundle check') || system!('bundle install')
25
26   puts "\n== Updating database =="
27   system! 'bin/rails db:migrate'
28
29   puts "\n== Removing old logs and tempfiles =="
30   system! 'bin/rails log:clear tmp:clear'
31
32   puts "\n== Restarting application server =="
33   system! 'bin/rails restart'
34 end