1
1
#!/usr/bin/env ruby
2
2
require "fileutils"
3
- require 'date'
4
3
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"
7
6
8
7
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 )
26
9
end
27
10
28
11
FileUtils . chdir APP_ROOT do
29
12
# This script is a way to set up or update your development environment automatically.
30
13
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
31
14
# Add necessary setup steps to this file.
32
15
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" )
36
19
37
20
# 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"
40
23
# end
41
24
42
25
puts "\n == Preparing database =="
43
- system! ' bin/rails db:prepare'
26
+ system! " bin/rails db:prepare"
44
27
45
28
puts "\n == Upserting application data =="
46
29
system! 'bin/rails dojos:update_db_by_yaml'
@@ -61,8 +44,28 @@ FileUtils.chdir APP_ROOT do
61
44
end
62
45
63
46
puts "\n == Removing old logs and tempfiles =="
64
- system! ' bin/rails log:clear tmp:clear'
47
+ system! " bin/rails log:clear tmp:clear"
65
48
66
49
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
68
71
end
0 commit comments