42
|
1 #!/usr/bin/env ruby
|
214
|
2 require "fileutils"
|
42
|
3
|
223
|
4 APP_ROOT = File.expand_path("..", __dir__)
|
42
|
5
|
72
|
6 def system!(*args)
|
254
|
7 system(*args, exception: true)
|
72
|
8 end
|
|
9
|
185
|
10 FileUtils.chdir APP_ROOT do
|
214
|
11 # This script is a way to set up or update your development environment automatically.
|
|
12 # This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
72
|
13 # Add necessary setup steps to this file.
|
42
|
14
|
223
|
15 puts "== Installing dependencies =="
|
|
16 system("bundle check") || system!("bundle install")
|
42
|
17
|
|
18 puts "\n== Removing old logs and tempfiles =="
|
223
|
19 system! "bin/rails log:clear tmp:clear"
|
42
|
20
|
255
|
21 unless ARGV.include?("--skip-server")
|
|
22 puts "\n== Starting development server =="
|
|
23 STDOUT.flush # flush the output before exec(2) so that it displays
|
|
24 exec "bin/dev"
|
|
25 end
|
42
|
26 end
|