annotate bin/setup @ 250:be0b78fb5f57

Link to original tweet in tweet header Otherwise there's no link for quote retweets.
author nanaya <me@nanaya.net>
date Mon, 17 Jul 2023 20:45:24 +0900
parents ad6264cca788
children 89f6c0016bab
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.
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
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
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
16 puts "== Installing dependencies =="
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
17 system! "gem install bundler --conservative"
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
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 =="
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
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 =="
223
ad6264cca788 Update to rails 7
nanaya <me@nanaya.pro>
parents: 214
diff changeset
24 system! "bin/rails restart"
42
97a6973e9d94 Reset default scripts.
edogawaconan <me@myconan.net>
parents:
diff changeset
25 end