]> git.openstreetmap.org Git - rails.git/blob - bin/setup
Add frozen_string_literal comments to ruby files
[rails.git] / bin / setup
1 #!/usr/bin/env ruby
2 # frozen_string_literal: true
3
4 require "fileutils"
5
6 APP_ROOT = File.expand_path("..", __dir__)
7
8 def system!(*)
9   system(*, :exception => true)
10 end
11
12 FileUtils.chdir APP_ROOT do
13   # This script is a way to set up or update your development environment automatically.
14   # This script is idempotent, so that you can run it at any time and get an expectable outcome.
15   # Add necessary setup steps to this file.
16
17   puts "== Installing dependencies =="
18   system("bundle check") || system!("bundle install")
19
20   # puts "\n== Copying sample files =="
21   # unless File.exist?("config/database.yml")
22   #   FileUtils.cp "config/database.yml.sample", "config/database.yml"
23   # end
24
25   puts "\n== Preparing database =="
26   system! "bin/rails db:prepare"
27
28   puts "\n== Removing old logs and tempfiles =="
29   system! "bin/rails log:clear tmp:clear"
30
31   unless ARGV.include?("--skip-server")
32     puts "\n== Starting development server =="
33     $stdout.flush # flush the output before exec(2) so that it displays
34     exec "bin/dev"
35   end
36 end