]> git.openstreetmap.org Git - rails.git/blob - bin/update
Add frozen_string_literal comments to ruby files
[rails.git] / bin / update
1 #!/usr/bin/env ruby
2 # frozen_string_literal: true
3
4 require "fileutils"
5 include FileUtils
6
7 # path to your application root.
8 APP_ROOT = File.expand_path("..", __dir__)
9
10 def system!(*args)
11   system(*args) || abort("\n== Command #{args} failed ==")
12 end
13
14 chdir APP_ROOT do
15   # This script is a way to update your development environment automatically.
16   # Add necessary update steps to this file.
17
18   puts "== Installing dependencies =="
19   system! "gem install bundler --conservative"
20   system("bundle check") || system!("bundle install")
21
22   # Install JavaScript dependencies if using Yarn
23   # system('bin/yarn')
24
25   puts "\n== Updating database =="
26   system! "bin/rails db:migrate"
27
28   puts "\n== Removing old logs and tempfiles =="
29   system! "bin/rails log:clear tmp:clear"
30
31   puts "\n== Restarting application server =="
32   system! "bin/rails restart"
33 end