souls 1.12.2 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/souls/app/index.rb +1 -0
  3. data/lib/souls/app/utils/firebase_id_token.rb +1 -1
  4. data/lib/souls/app/utils/painter.rb +33 -0
  5. data/lib/souls/app/utils/souls_logger.rb +1 -1
  6. data/lib/souls/cli/create/index.rb +14 -12
  7. data/lib/souls/cli/db/create_migration_rbs.rb +1 -1
  8. data/lib/souls/cli/db/index.rb +1 -0
  9. data/lib/souls/cli/db/model.rb +1 -1
  10. data/lib/souls/cli/db/model_rbs.rb +1 -1
  11. data/lib/souls/cli/db/rspec_model.rb +1 -1
  12. data/lib/souls/cli/delete/connection_rbs.rb +1 -1
  13. data/lib/souls/cli/delete/edge.rb +1 -1
  14. data/lib/souls/cli/delete/job.rb +1 -1
  15. data/lib/souls/cli/delete/job_rbs.rb +1 -1
  16. data/lib/souls/cli/delete/manager.rb +1 -1
  17. data/lib/souls/cli/delete/manager_rbs.rb +1 -1
  18. data/lib/souls/cli/delete/migration_file.rb +24 -0
  19. data/lib/souls/cli/delete/mutation.rb +1 -1
  20. data/lib/souls/cli/delete/mutation_rbs.rb +1 -1
  21. data/lib/souls/cli/delete/query.rb +1 -1
  22. data/lib/souls/cli/delete/query_rbs.rb +1 -1
  23. data/lib/souls/cli/delete/resolver.rb +1 -1
  24. data/lib/souls/cli/delete/resolver_rbs.rb +1 -1
  25. data/lib/souls/cli/delete/rspec_factory.rb +1 -1
  26. data/lib/souls/cli/delete/rspec_job.rb +1 -1
  27. data/lib/souls/cli/delete/rspec_manager.rb +1 -1
  28. data/lib/souls/cli/delete/rspec_mutation.rb +1 -1
  29. data/lib/souls/cli/delete/rspec_query.rb +1 -1
  30. data/lib/souls/cli/delete/rspec_resolver.rb +1 -1
  31. data/lib/souls/cli/delete/type.rb +1 -1
  32. data/lib/souls/cli/delete/type_rbs.rb +1 -1
  33. data/lib/souls/cli/gcloud/compute/index.rb +2 -2
  34. data/lib/souls/cli/gcloud/iam/index.rb +8 -2
  35. data/lib/souls/cli/gcloud/sql/index.rb +46 -38
  36. data/lib/souls/cli/generate/connection.rb +1 -1
  37. data/lib/souls/cli/generate/connection_rbs.rb +1 -1
  38. data/lib/souls/cli/generate/edge.rb +1 -1
  39. data/lib/souls/cli/generate/edge_rbs.rb +2 -2
  40. data/lib/souls/cli/generate/job.rb +4 -4
  41. data/lib/souls/cli/generate/job_rbs.rb +1 -1
  42. data/lib/souls/cli/generate/manager.rb +7 -4
  43. data/lib/souls/cli/generate/manager_rbs.rb +2 -2
  44. data/lib/souls/cli/generate/mutation.rb +4 -4
  45. data/lib/souls/cli/generate/mutation_rbs.rb +4 -4
  46. data/lib/souls/cli/generate/query.rb +2 -2
  47. data/lib/souls/cli/generate/query_rbs.rb +2 -2
  48. data/lib/souls/cli/generate/resolver.rb +1 -1
  49. data/lib/souls/cli/generate/resolver_rbs.rb +2 -2
  50. data/lib/souls/cli/generate/rspec_factory.rb +1 -1
  51. data/lib/souls/cli/generate/rspec_job.rb +1 -1
  52. data/lib/souls/cli/generate/rspec_manager.rb +1 -1
  53. data/lib/souls/cli/generate/rspec_mutation.rb +1 -1
  54. data/lib/souls/cli/generate/rspec_query.rb +1 -1
  55. data/lib/souls/cli/generate/rspec_resolver.rb +1 -1
  56. data/lib/souls/cli/generate/type.rb +1 -1
  57. data/lib/souls/cli/generate/type_rbs.rb +1 -1
  58. data/lib/souls/cli/github/index.rb +10 -7
  59. data/lib/souls/cli/release/release.rb +1 -1
  60. data/lib/souls/cli/sync/conf.rb +5 -7
  61. data/lib/souls/cli/sync/model.rb +1 -1
  62. data/lib/souls/cli/sync/pubsub.rb +1 -1
  63. data/lib/souls/cli/update/mutation.rb +6 -10
  64. data/lib/souls/cli/update/mutation_rbs.rb +2 -2
  65. data/lib/souls/cli/update/resolver.rb +1 -1
  66. data/lib/souls/cli/update/rspec_factory.rb +1 -1
  67. data/lib/souls/cli/update/rspec_mutation.rb +1 -1
  68. data/lib/souls/cli/update/rspec_resolver.rb +1 -1
  69. data/lib/souls/cli/update/type.rb +1 -1
  70. data/lib/souls/cli/update/type_rbs.rb +1 -1
  71. data/lib/souls/cli/upgrade/config.rb +3 -0
  72. data/lib/souls/version.rb +1 -1
  73. data/lib/souls/versions/.souls_api_version +1 -1
  74. data/lib/souls/versions/.souls_worker_version +1 -1
  75. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d291ae2cbca7be677a5a17bcd5be72f91e2d6fdb738732855d859ce9bd57c292
4
- data.tar.gz: cb784d99ce95dfd680d068dcd3253ac06efb62eb773a3229a7a297af30e0a5a1
3
+ metadata.gz: 7f2379099a16dfdc0ae7b5e49cf8cb1cb15e75c2542e8b2a60083949b72308dd
4
+ data.tar.gz: 75f87b3b1b6223364ca964190c44a09856f629dfbdfcb952d7a1c61064a1709a
5
5
  SHA512:
6
- metadata.gz: 9ff1abbce1850a539e3e885687f85ce2208ce2410f8031afe52d033620feb971e79ea808448f81d2807f2f11249850e8d9fd2eae6d5b1a888108d3f07b9c84ba
7
- data.tar.gz: d15ffb53f4c1cfb37f3e5b8c1f2574feb52046fc5c45c8da5856bbebbd3ea12ac5df19a5ba214cacd9f5bc87017521d5ec9058da38c45e0f8f95ab8dc54503c2
6
+ metadata.gz: dd51f504d1f187379daf97e9878801463a37ee83155137b7d57bc9f12036c628eb64e69863b0e0e0d0848bd090f25a3af00534f7bcdea59d202232f28cd1f591
7
+ data.tar.gz: 6554f9f8ff01dd5e320c5283c202765f970a5ae74461b18606b27c7acfe2b57e75257315838a4409ea7bf334c2bc98216c76c909afa25205a36b5b11104c31c6
@@ -2,6 +2,7 @@ require_relative "graphql/souls_mutation"
2
2
  require_relative "graphql/souls_query"
3
3
  require_relative "graphql/souls_connection"
4
4
  require_relative "utils/souls_logger"
5
+ require_relative "utils/painter"
5
6
  require_relative "utils/firebase_id_token"
6
7
  require_relative "graphql/types/index"
7
8
 
@@ -1,3 +1,3 @@
1
1
  FirebaseIdToken.configure do |config|
2
- config.project_ids = [ENV["GCP_PROJECT_ID"]]
2
+ config.project_ids = [ENV["SOULS_GCP_PROJECT_ID"]]
3
3
  end
@@ -0,0 +1,33 @@
1
+ module Souls
2
+ module Painter
3
+ class << self
4
+ def create_file(text)
5
+ puts(Paint % ["✓ %{white_text}", :green, { white_text: ["Created file #{text}", :white] }])
6
+ end
7
+
8
+ def update_file(text)
9
+ puts(Paint % ["✓ %{white_text}", :yellow, { white_text: ["Updated file #{text}", :white] }])
10
+ end
11
+
12
+ def delete_file(text)
13
+ puts(Paint % ["✓ %{white_text}", :red, { white_text: ["Deleted file #{text}", :white] }])
14
+ end
15
+
16
+ def error(text)
17
+ puts(Paint["🚨 #{text}", :red])
18
+ end
19
+
20
+ def warning(text)
21
+ puts(Paint["🚨 #{text}", :yellow])
22
+ end
23
+
24
+ def success(text)
25
+ puts(Paint["🎉 #{text}", :green])
26
+ end
27
+
28
+ def sync(text)
29
+ puts(Paint % ["✓ %{white_text}", :blue, { white_text: ["Synced #{text}", :white] }])
30
+ end
31
+ end
32
+ end
33
+ end
@@ -43,7 +43,7 @@ module Souls
43
43
 
44
44
  def self.write_log(message)
45
45
  entry = configuration.logger.entry
46
- entry.payload = "#{message}\n #{message.backtrace.join("\n")}"
46
+ entry.payload = message.backtrace.nil? ? "#{message}\n" : "#{message}\n #{message.backtrace.join("\n")}"
47
47
  entry.log_name = "error"
48
48
  entry.resource.type = "cloud_run_revision"
49
49
  entry.resource.labels[:service_name] = "souls"
@@ -145,11 +145,24 @@ end
145
145
  uses: ruby/setup-ruby@v1
146
146
  with:
147
147
  ruby-version: 3.0
148
+
149
+ - name: Checkout the repository
150
+ uses: actions/checkout@v2
151
+
152
+ - name: GCP Authenticate
153
+ uses: google-github-actions/setup-gcloud@master
154
+ with:
155
+ version: "323.0.0"
156
+ project_id: ${{ secrets.SOULS_GCP_PROJECT_ID }}
157
+ service_account_key: ${{ secrets.SOULS_GCP_SA_KEY }}
158
+ export_default_credentials: true
159
+
148
160
  - name: Build and test with Rake
149
161
  env:
150
162
  PGHOST: 127.0.0.1
151
163
  PGUSER: postgres
152
164
  RACK_ENV: test
165
+ SOULS_GCP_PROJECT_ID: ${{ secrets.SOULS_GCP_PROJECT_ID }}
153
166
  run: |
154
167
  sudo apt-get -yqq install libpq-dev
155
168
  cd apps/#{worker_name}
@@ -159,17 +172,6 @@ end
159
172
  bundle exec rake db:migrate RACK_ENV=test
160
173
  bundle exec rspec
161
174
 
162
- - name: Checkout the repository
163
- uses: actions/checkout@v2
164
-
165
- - name: GCP Authenticate
166
- uses: google-github-actions/setup-gcloud@master
167
- with:
168
- version: "323.0.0"
169
- project_id: ${{ secrets.SOULS_GCP_PROJECT_ID }}
170
- service_account_key: ${{ secrets.SOULS_GCP_SA_KEY }}
171
- export_default_credentials: true
172
-
173
175
  - name: Sync Tasks
174
176
  run: cd apps/#{worker_name} && souls gcloud scheduler sync_schedules --timezone=${{ secrets.TZ }}
175
177
 
@@ -203,7 +205,7 @@ end
203
205
  --set-env-vars="SOULS_PROJECT_ID=${{ secrets.SOULS_GCP_PROJECT_ID }}"
204
206
  TEXT
205
207
  end
206
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
208
+ Souls::Painter.create_file(file_path.to_s)
207
209
  file_path
208
210
  end
209
211
 
@@ -17,7 +17,7 @@ module Souls
17
17
  end
18
18
  TEXT
19
19
  end
20
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
20
+ Souls::Painter.create_file(file_path.to_s)
21
21
  end
22
22
  file_path
23
23
  end
@@ -51,6 +51,7 @@ module Souls
51
51
  db_system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
52
52
  else
53
53
  db_system("rake db:migrate:reset")
54
+ db_system("rake db:migrate RACK_ENV=test")
54
55
  end
55
56
  end
56
57
 
@@ -13,7 +13,7 @@ module Souls
13
13
  end
14
14
  TEXT
15
15
  end
16
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
16
+ Souls::Painter.create_file(file_path.to_s)
17
17
  file_path
18
18
  end
19
19
  end
@@ -14,7 +14,7 @@ module Souls
14
14
  end
15
15
  TEXT
16
16
  end
17
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
17
+ Souls::Painter.create_file(file_path.to_s)
18
18
  end
19
19
  file_path
20
20
  end
@@ -18,7 +18,7 @@ module Souls
18
18
  end
19
19
  TEXT
20
20
  end
21
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
21
+ Souls::Painter.create_file(file_path.to_s)
22
22
  file_path
23
23
  end
24
24
  end
@@ -8,7 +8,7 @@ module Souls
8
8
  file_dir = "./sig/api/app/graphql/types/connections/"
9
9
  file_path = "#{file_dir}#{singularized_class_name}_connection.rbs"
10
10
  FileUtils.rm_f(file_path)
11
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ Souls::Painter.delete_file(file_path.to_s)
12
12
  end
13
13
  file_path
14
14
  end
@@ -6,7 +6,7 @@ module Souls
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_path = "#{file_dir}#{singularized_class_name}_edge.rb"
8
8
  FileUtils.rm_f(file_path)
9
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ Souls::Painter.delete_file(file_path.to_s)
10
10
  file_path
11
11
  end
12
12
  end
@@ -7,7 +7,7 @@ module Souls
7
7
  file_path = "#{file_dir}#{class_name.singularize}.rb"
8
8
 
9
9
  FileUtils.rm_f(file_path)
10
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
10
+ Souls::Painter.delete_file(file_path.to_s)
11
11
  Souls::Delete.new.invoke(:job_rbs, [class_name], {})
12
12
  Souls::Delete.new.invoke(:rspec_job, [class_name], {})
13
13
  end
@@ -14,7 +14,7 @@ module Souls
14
14
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
15
15
  file_path = "#{file_dir}#{singularized_class_name}.rbs"
16
16
  FileUtils.rm_f(file_path)
17
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
17
+ Souls::Painter.delete_file(file_path.to_s)
18
18
  end
19
19
  file_path
20
20
  end
@@ -8,7 +8,7 @@ module Souls
8
8
  file_path = "#{file_dir}/#{options[:mutation]}.rb"
9
9
 
10
10
  FileUtils.rm_f(file_path)
11
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ Souls::Painter.delete_file(file_path.to_s)
12
12
  Souls::Delete.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
13
13
  Souls::Delete.new.invoke(:rspec_manager, [singularized_class_name], { mutation: options[:mutation] })
14
14
  file_path
@@ -9,7 +9,7 @@ module Souls
9
9
  file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
10
10
  file_path = "#{file_dir}/#{options[:mutation]}.rbs"
11
11
  FileUtils.rm_f(file_path)
12
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
12
+ Souls::Painter.delete_file(file_path.to_s)
13
13
  end
14
14
  file_path
15
15
  end
@@ -0,0 +1,24 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "migration [migration_NAME]", "Delete Migration files Template"
4
+ def migration(class_name)
5
+ singularized_class_name = class_name.underscore.singularize
6
+ pluralized_class_name = class_name.underscore.pluralize
7
+ Dir.chdir(Souls.get_mother_path.to_s) do
8
+ file_paths = {
9
+ model_file_path: "./apps/api/app/models/#{singularized_class_name}.rb",
10
+ rspec_file_path: "./apps/api/spec/models/#{singularized_class_name}_spec.rb",
11
+ rbs_file_path: "./sig/api/app/models/#{singularized_class_name}.rbs",
12
+ migration_file_path: Dir["db/migrate/*create_#{pluralized_class_name}.rb"].first
13
+ }
14
+ file_paths.each do |_k, v|
15
+ FileUtils.rm_f(v)
16
+ Souls::Painter.delete_file(v)
17
+ rescue StandardError => e
18
+ puts(e)
19
+ end
20
+ file_paths
21
+ end
22
+ end
23
+ end
24
+ end
@@ -8,7 +8,7 @@ module Souls
8
8
  file_path = "./app/graphql/mutations/base/#{singularized_class_name}/"
9
9
  FileUtils.rm_rf(file_path)
10
10
  end
11
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ Souls::Painter.delete_file(file_path.to_s)
12
12
  file_path
13
13
  end
14
14
  end
@@ -8,7 +8,7 @@ module Souls
8
8
  file_dir = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
9
9
  FileUtils.rm_rf(file_dir)
10
10
  end
11
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ Souls::Painter.delete_file(file_path.to_s)
12
12
  file_path
13
13
  end
14
14
  end
@@ -5,7 +5,7 @@ module Souls
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./app/graphql/queries/#{singularized_class_name}*.rb"
7
7
  FileUtils.rm_f(file_path)
8
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
+ Souls::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -8,7 +8,7 @@ module Souls
8
8
  singularized_class_name = class_name.underscore.singularize
9
9
  file_path = "#{file_dir}#{singularized_class_name}*.rbs"
10
10
  FileUtils.rm_f(file_path)
11
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ Souls::Painter.delete_file(file_path.to_s)
12
12
  file_path
13
13
  end
14
14
  end
@@ -5,7 +5,7 @@ module Souls
5
5
  singularized_class_name = class_name.singularize.underscore
6
6
  file_path = "./app/graphql/resolvers/#{singularized_class_name}_search.rb"
7
7
  FileUtils.rm_f(file_path)
8
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
+ Souls::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -9,7 +9,7 @@ module Souls
9
9
  file_path = "#{file_dir}/#{singularized_class_name}_search.rbs"
10
10
  FileUtils.rm_f(file_path)
11
11
  end
12
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
12
+ Souls::Painter.delete_file(file_path.to_s)
13
13
  file_path
14
14
  end
15
15
  end
@@ -4,7 +4,7 @@ module Souls
4
4
  def rspec_factory(class_name)
5
5
  file_path = "./spec/factories/#{class_name.pluralize}.rb"
6
6
  FileUtils.rm_f(file_path)
7
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
7
+ Souls::Painter.delete_file(file_path.to_s)
8
8
  file_path
9
9
  end
10
10
  end
@@ -6,7 +6,7 @@ module Souls
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_path = "#{file_dir}/#{singularized_class_name}_spec.rb"
8
8
  FileUtils.rm_f(file_path)
9
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ Souls::Painter.delete_file(file_path.to_s)
10
10
  file_path
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Souls
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_path = "./spec/mutations/managers/#{singularized_class_name}/#{options[:mutation]}_spec.rb"
8
8
  FileUtils.rm_f(file_path)
9
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ Souls::Painter.delete_file(file_path.to_s)
10
10
  file_path
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ module Souls
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/mutations/base/#{singularized_class_name}_spec.rb"
7
7
  FileUtils.rm_f(file_path)
8
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
+ Souls::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Souls
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/queries/#{singularized_class_name}_spec.rb"
7
7
  FileUtils.rm_f(file_path)
8
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
+ Souls::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Souls
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/resolvers/#{singularized_class_name}_search_spec.rb"
7
7
  FileUtils.rm_f(file_path)
8
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
+ Souls::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Souls
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./app/graphql/types/#{singularized_class_name}_type.rb"
7
7
  FileUtils.rm_f(file_path)
8
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
+ Souls::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -9,7 +9,7 @@ module Souls
9
9
  file_path = "#{file_dir}/#{singularized_class_name}_type.rbs"
10
10
  FileUtils.rm_f(file_path)
11
11
  end
12
- puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
12
+ Souls::Painter.delete_file(file_path.to_s)
13
13
  file_path
14
14
  end
15
15
  end
@@ -16,7 +16,7 @@ module Souls
16
16
  Souls::Sql.new.invoke(:setup_private_ip)
17
17
  update_workflows
18
18
  update_env
19
- puts(Paint["Cloud NAT is All Set!\n", :white])
19
+ Souls::Painter.success("Cloud NAT is All Set!")
20
20
  puts(
21
21
  Paint % [
22
22
  "Your Worker's External IP: %{white_text}",
@@ -133,7 +133,7 @@ module Souls
133
133
  end
134
134
  workflow.insert(index, " --vpc-connector=#{app_name}-connector \\\n") if connector_index.nil?
135
135
  File.open(file_path, "w") { |f| f.write(workflow.join) }
136
- puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
136
+ Souls::Painter.update_file(file_path.to_s)
137
137
  end
138
138
  end
139
139
  end
@@ -4,11 +4,16 @@ module Souls
4
4
  def setup_key
5
5
  region = Souls.configuration.region
6
6
  Souls::Gcloud.new.auth_login
7
+ Souls::Upgrade.new.config
7
8
  create_service_account
8
9
  create_service_account_key
9
10
  Souls::Gcloud.new.enable_permissions
10
11
  add_permissions
11
- system("gcloud app create --region=#{region} --quiet")
12
+ begin
13
+ system("gcloud app create --region=#{region} --quiet")
14
+ rescue StandardError, error
15
+ puts("gcloud app region is Already exist! - Souls::Gcloud::Iam.setup_key")
16
+ end
12
17
  begin
13
18
  set_gh_secret_json
14
19
  rescue StandardError
@@ -95,7 +100,8 @@ module Souls
95
100
  "roles/storage.admin",
96
101
  "roles/storage.objectAdmin",
97
102
  "roles/cloudscheduler.admin",
98
- "roles/appengine.appCreator"
103
+ "roles/appengine.appCreator",
104
+ "roles/logging.admin"
99
105
  ]
100
106
  roles.each do |role|
101
107
  add_service_account_role(role: role)
@@ -13,44 +13,48 @@ module Souls
13
13
  db_type = options[:mysql] ? "MYSQL_8_0" : "POSTGRES_13"
14
14
 
15
15
  zone = "#{region}-b"
16
- system("gcloud config set project #{project_id}")
17
- system(
18
- "gcloud sql instances create #{instance_name} \
19
- --database-version=#{db_type} --cpu=1 --memory=4096MB --zone=#{zone} \
20
- --root-password='#{password}' --database-flags cloudsql.iam_authentication=on"
21
- )
22
- instance_ip = `gcloud sql instances list | grep #{instance_name} | awk '{print $5}'`.strip
23
- Dir.chdir(Souls.get_api_path.to_s) do
24
- file_path = ".env"
25
- File.open(file_path, "w") do |line|
26
- line.write(<<~TEXT)
27
- GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS=1
28
- SOULS_DB_HOST=#{instance_ip}
29
- SOULS_DB_PW=#{password}
30
- SOULS_DB_USER=postgres
31
- SOULS_GCP_PROJECT_ID=#{project_id}
32
- SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
33
- TZ="#{region_to_timezone(region: region)}"
34
- TEXT
16
+ system("gcloud config set project #{project_id} >/dev/null 2>&1")
17
+ Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
18
+ system(
19
+ "gcloud sql instances create #{instance_name} \
20
+ --database-version=#{db_type} --cpu=1 --memory=4096MB --zone=#{zone} \
21
+ --root-password='#{password}' --database-flags cloudsql.iam_authentication=on"
22
+ )
23
+ instance_ip = `gcloud sql instances list | grep #{instance_name} | awk '{print $5}'`.strip
24
+ Dir.chdir(Souls.get_api_path.to_s) do
25
+ file_path = ".env"
26
+ File.open(file_path, "w") do |line|
27
+ line.write(<<~TEXT)
28
+ GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS=1
29
+ SOULS_DB_HOST=#{instance_ip}
30
+ SOULS_DB_PW=#{password}
31
+ SOULS_DB_USER=postgres
32
+ SOULS_GCP_PROJECT_ID=#{project_id}
33
+ SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
34
+ TZ="#{region_to_timezone(region: region)}"
35
+ TEXT
36
+ end
35
37
  end
36
- end
37
- Dir.chdir(Souls.get_mother_path.to_s) do
38
- file_path = ".env.production"
39
- File.open(file_path, "w") do |line|
40
- line.write(<<~TEXT)
41
- SOULS_DB_HOST="/cloudsql/#{project_id}:#{region}:#{instance_name}"
42
- SOULS_DB_PW=#{password}
43
- SOULS_DB_USER=postgres
44
- SOULS_APP_NAME=#{app_name}
45
- SOULS_GCP_PROJECT_ID=#{project_id}
46
- SOULS_GCP_REGION=#{region}
47
- SOULS_GCLOUDSQL_INSTANCE="#{project_id}:#{region}:#{instance_name}"
48
- SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
49
- TZ="#{region_to_timezone(region: region)}"
50
- TEXT
38
+ Dir.chdir(Souls.get_mother_path.to_s) do
39
+ file_path = ".env.production"
40
+ File.open(file_path, "w") do |line|
41
+ line.write(<<~TEXT)
42
+ SOULS_DB_HOST="/cloudsql/#{project_id}:#{region}:#{instance_name}"
43
+ SOULS_DB_PW=#{password}
44
+ SOULS_DB_USER=postgres
45
+ SOULS_APP_NAME=#{app_name}
46
+ SOULS_GCP_PROJECT_ID=#{project_id}
47
+ SOULS_GCP_REGION=#{region}
48
+ SOULS_GCLOUDSQL_INSTANCE="#{project_id}:#{region}:#{instance_name}"
49
+ SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
50
+ TZ="#{region_to_timezone(region: region)}"
51
+ TEXT
52
+ end
51
53
  end
54
+ Souls::Github.new.secret_set
55
+ Whirly.status = Paint["Cloud SQL #{instance_name} is successfully created! You can push to deploy!", :green]
52
56
  end
53
- Souls::Github.new
57
+ true
54
58
  end
55
59
 
56
60
  desc "list", "Show Cloud SQL Instances List"
@@ -130,15 +134,19 @@ module Souls
130
134
  ips = (ips + white_ips).uniq
131
135
  end
132
136
  ips = ips.join(",")
133
- system(
134
- "
137
+ Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
138
+ system(
139
+ "
135
140
  gcloud sql instances patch #{instance_name} \
136
141
  --project=#{project_id} \
137
142
  --assign-ip \
138
143
  --authorized-networks=#{ips} \
139
144
  --quiet
140
145
  "
141
- )
146
+ )
147
+ Whirly.status = Paint["Your IP is successfully added!", :green]
148
+ end
149
+ true
142
150
  end
143
151
 
144
152
  private
@@ -13,7 +13,7 @@ module Souls
13
13
  end
14
14
  TEXT
15
15
  end
16
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
16
+ Souls::Painter.create_file(file_path.to_s)
17
17
  file_path
18
18
  end
19
19
  end
@@ -17,7 +17,7 @@ module Souls
17
17
  end
18
18
  TEXT
19
19
  end
20
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
20
+ Souls::Painter.create_file(file_path.to_s)
21
21
  end
22
22
  file_path
23
23
  end
@@ -13,7 +13,7 @@ module Souls
13
13
  end
14
14
  TEXT
15
15
  end
16
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
16
+ Souls::Painter.create_file(file_path.to_s)
17
17
  file_path
18
18
  end
19
19
  end
@@ -11,7 +11,7 @@ module Souls
11
11
  File.open(file_path, "w") do |f|
12
12
  f.write(<<~TEXT)
13
13
  module Types
14
- class #{singularized_class_name.camelize}Edge < BaseObject
14
+ class #{singularized_class_name.camelize}Edge < Types::BaseEdge
15
15
  def self.edge_type: (*untyped) -> untyped
16
16
  def self.node_type: (*untyped) -> untyped
17
17
  def self.global_id_field: (*untyped) -> untyped
@@ -20,7 +20,7 @@ module Souls
20
20
  end
21
21
  TEXT
22
22
  end
23
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
23
+ Souls::Painter.create_file(file_path.to_s)
24
24
  end
25
25
  file_path
26
26
  end