42
|
1 #!/usr/bin/env ruby
|
185
|
2 require 'fileutils'
|
42
|
3
|
|
4 # path to your application root.
|
185
|
5 APP_ROOT = File.expand_path('..', __dir__)
|
42
|
6
|
72
|
7 def system!(*args)
|
|
8 system(*args) || abort("\n== Command #{args} failed ==")
|
|
9 end
|
|
10
|
185
|
11 FileUtils.chdir APP_ROOT do
|
|
12 # This script is a way to setup or update your development environment automatically.
|
|
13 # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
72
|
14 # Add necessary setup steps to this file.
|
42
|
15
|
185
|
16 puts '== Installing dependencies =='
|
|
17 system! 'gem install bundler --conservative'
|
|
18 system('bundle check') || system!('bundle install')
|
42
|
19
|
|
20 puts "\n== Removing old logs and tempfiles =="
|
185
|
21 system! 'bin/rails log:clear tmp:clear'
|
42
|
22
|
|
23 puts "\n== Restarting application server =="
|
185
|
24 system! 'bin/rails restart'
|
42
|
25 end
|