Skip to content

Commit 543fd2f

Browse files
committed
Update for Rails 7.2: bin/setup
1 parent 7ed5fff commit 543fd2f

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

bin/setup

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,29 @@
11
#!/usr/bin/env ruby
22
require "fileutils"
3-
require 'date'
43

5-
# path to your application root.
6-
APP_ROOT = File.expand_path('..', __dir__)
4+
APP_ROOT = File.expand_path("..", __dir__)
5+
APP_NAME = "coderdojo-jp"
76

87
def system!(*args)
9-
system(*args) || abort("\n== Command #{args} failed ==")
10-
end
11-
12-
def doorkeeper_message
13-
<<~MESSAGE
14-
15-
環境変数 DOORKEEPER_API_TOKEN が設定されていないため、
16-
Doorkeeper API を使ったイベント情報の取得をスキップします。
17-
18-
Doorkeeper のイベントを取得するためには、
19-
下記ページから Doorkeeper API Token を取得し、
20-
環境変数 DOORKEEPER_API_TOKEN に設定してください。
21-
https://manage.doorkeeper.jp/user/oauth/applications
22-
23-
環境変数設定後に、bin/setup を再実行してください!
24-
25-
MESSAGE
8+
system(*args, exception: true)
269
end
2710

2811
FileUtils.chdir APP_ROOT do
2912
# This script is a way to set up or update your development environment automatically.
3013
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
3114
# Add necessary setup steps to this file.
3215

33-
puts '== Installing dependencies =='
34-
system! 'gem install bundler --conservative'
35-
system('bundle check') || system!('bundle install')
16+
puts "== Installing dependencies =="
17+
system! "gem install bundler --conservative"
18+
system("bundle check") || system!("bundle install")
3619

3720
# puts "\n== Copying sample files =="
38-
# unless File.exist?('config/database.yml')
39-
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml"
21+
# unless File.exist?("config/database.yml")
22+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
4023
# end
4124

4225
puts "\n== Preparing database =="
43-
system! 'bin/rails db:prepare'
26+
system! "bin/rails db:prepare"
4427

4528
puts "\n== Upserting application data =="
4629
system! 'bin/rails dojos:update_db_by_yaml'
@@ -61,8 +44,28 @@ FileUtils.chdir APP_ROOT do
6144
end
6245

6346
puts "\n== Removing old logs and tempfiles =="
64-
system! 'bin/rails log:clear tmp:clear'
47+
system! "bin/rails log:clear tmp:clear"
6548

6649
puts "\n== Restarting application server =="
67-
system! 'bin/rails restart'
50+
system! "bin/rails restart"
51+
52+
# puts "\n== Configuring puma-dev =="
53+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
54+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
55+
end
56+
57+
def doorkeeper_message
58+
<<~MESSAGE
59+
60+
環境変数 DOORKEEPER_API_TOKEN が設定されていないため、
61+
Doorkeeper API を使ったイベント情報の取得をスキップします。
62+
63+
Doorkeeper のイベントを取得するためには、
64+
下記ページから Doorkeeper API Token を取得し、
65+
環境変数 DOORKEEPER_API_TOKEN に設定してください。
66+
https://manage.doorkeeper.jp/user/oauth/applications
67+
68+
環境変数設定後に、bin/setup を再実行してください!
69+
70+
MESSAGE
6871
end

0 commit comments

Comments
 (0)