Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / apps / workbench / bin / update
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 way to update your development environment automatically.
19   # Add necessary update steps to this file.
20
21   puts '== Installing dependencies =='
22   system! 'gem install bundler --conservative'
23   system('bundle check') || system!('bundle install')
24
25   # Install JavaScript dependencies if using Yarn
26   # system('bin/yarn')
27
28   puts "\n== Updating database =="
29   system! 'bin/rails db:migrate'
30
31   puts "\n== Removing old logs and tempfiles =="
32   system! 'bin/rails log:clear tmp:clear'
33
34   puts "\n== Restarting application server =="
35   system! 'bin/rails restart'
36 end