annotate bin/setup @ 217:12555a247f93

Update gems
author nanaya <me@nanaya.pro>
date Sun, 10 Jan 2021 23:41:18 +0900
parents 2335107f35d0
children ad6264cca788
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
214
2335107f35d0 Run rails update
nanaya <me@nanaya.pro>
parents: 185
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
214
2335107f35d0 Run rails update
nanaya <me@nanaya.pro>
parents: 185
diff changeset
12 # This script is a way to set up or update your development environment automatically.
2335107f35d0 Run rails update
nanaya <me@nanaya.pro>
parents: 185
diff changeset
13 # This script is idempotent, so that you can run it at any time 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