annotate bin/setup @ 199:1204ab86a35b

Update gems
author nanaya <me@nanaya.pro>
date Sun, 28 Jun 2020 03:39:41 +0900
parents f67f3ad50270
children 2335107f35d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
1 #!/usr/bin/env ruby
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
2 require 'fileutils'
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
3
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
4 # path to your application root.
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
5 APP_ROOT = File.expand_path('..', __dir__)
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
6
72
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents: 44
diff changeset
7 def system!(*args)
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents: 44
diff changeset
8 system(*args) || abort("\n== Command #{args} failed ==")
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents: 44
diff changeset
9 end
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents: 44
diff changeset
10
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
11 FileUtils.chdir APP_ROOT do
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
12 # This script is a way to setup or update your development environment automatically.
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
13 # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
72
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents: 44
diff changeset
14 # Add necessary setup steps to this file.
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
15
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
16 puts '== Installing dependencies =='
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
17 system! 'gem install bundler --conservative'
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
18 system('bundle check') || system!('bundle install')
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
19
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
20 puts "\n== Removing old logs and tempfiles =="
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
21 system! 'bin/rails log:clear tmp:clear'
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
22
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
23 puts "\n== Restarting application server =="
185
f67f3ad50270 Update to latest rails and gems
nanaya <me@nanaya.pro>
parents: 72
diff changeset
24 system! 'bin/rails restart'
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
25 end