souls 1.20.11 → 1.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/souls/app/graphql/souls_mutation.rb +5 -5
- data/lib/souls/app/graphql/souls_query.rb +2 -2
- data/lib/souls/cli/create/functions.rb +1 -1
- data/lib/souls/cli/create/index.rb +13 -13
- data/lib/souls/cli/delete/application.rb +1 -1
- data/lib/souls/cli/gcloud/iam/index.rb +1 -1
- data/lib/souls/cli/gcloud/scheduler/index.rb +1 -1
- data/lib/souls/cli/gcloud/sql/index.rb +3 -3
- data/lib/souls/cli/generate/mutation_rbs.rb +2 -2
- data/lib/souls/cli/generate/resolver.rb +2 -2
- data/lib/souls/cli/generate/rspec_factory.rb +1 -1
- data/lib/souls/cli/generate/rspec_mutation.rb +4 -4
- data/lib/souls/cli/generate/rspec_query.rb +3 -3
- data/lib/souls/cli/generate/rspec_resolver.rb +3 -3
- data/lib/souls/cli/generate/type.rb +1 -1
- data/lib/souls/cli/github/index.rb +4 -4
- data/lib/souls/cli/init/index.rb +7 -7
- data/lib/souls/cli/release/release.rb +3 -3
- data/lib/souls/cli/sync/model.rb +1 -1
- data/lib/souls/cli/sync/pubsub.rb +13 -13
- data/lib/souls/cli/update/mutation.rb +3 -3
- data/lib/souls/cli/update/resolver.rb +2 -2
- data/lib/souls/cli/update/rspec_factory.rb +1 -1
- data/lib/souls/cli/update/rspec_mutation.rb +3 -3
- data/lib/souls/cli/update/rspec_resolver.rb +2 -2
- data/lib/souls/cli/update/type.rb +1 -1
- data/lib/souls/cli/upgrade/gemfile.rb +1 -1
- data/lib/souls/utils/index.rb +12 -12
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a89158c6e9fd0e559f441dda8eba11f2cc1462ab98207485f2fe55f0accf1ad
|
4
|
+
data.tar.gz: ab20ea92d14380afdd1d4bdce5b5b9348e31fd385a47a941a2d3a3852ec7aa5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55683cfe2682abcf038f3b661e91fc7a6371ed423ce7e40be53fcb045bc00b14b1b4ed8b8f12481bd1c4be2a29aa8cc96b4124abf0058221d429d011cedc21a2
|
7
|
+
data.tar.gz: 5f98b5668e7e29d641c79db082a14d4fc13b0d8732898078e85f14ce4731d060285a74339391238e23877fde9c308e9151ecf817d372ef82de1e2f16f580fb2d
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module SOULs
|
2
2
|
class SOULsMutation < GraphQL::Schema::RelayClassicMutation
|
3
|
-
def
|
3
|
+
def souls_post(url:, payload: {}, content_type: "application/json")
|
4
4
|
response = Faraday.post(url, payload.to_json, "Content-Type": content_type)
|
5
5
|
response.body
|
6
6
|
end
|
@@ -9,12 +9,12 @@ module SOULs
|
|
9
9
|
query_file_name = query_file_name.gsub("_", "-")
|
10
10
|
topic_name = "souls-#{worker_name}-#{query_file_name}"
|
11
11
|
query = query_file_name.underscore.camelize(:lower)
|
12
|
-
query_string = souls_make_graphql_query(query
|
12
|
+
query_string = souls_make_graphql_query(query:, args:)
|
13
13
|
case ENV["RACK_ENV"]
|
14
14
|
when "production"
|
15
|
-
souls_publish_pubsub_queue(topic_name
|
15
|
+
souls_publish_pubsub_queue(topic_name:, message: query_string)
|
16
16
|
when "development"
|
17
|
-
puts(souls_post_to_dev(worker_name
|
17
|
+
puts(souls_post_to_dev(worker_name:, query_string:))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -61,7 +61,7 @@ module SOULs
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def souls_post_to_dev(worker_name: "", query_string: "")
|
64
|
-
port = souls_get_worker(worker_name:
|
64
|
+
port = souls_get_worker(worker_name:)[0][:port]
|
65
65
|
endpoint = SOULs.configuration.endpoint
|
66
66
|
res = Net::HTTP.post_form(URI.parse("http://localhost:#{port}#{endpoint}"), { query: query_string })
|
67
67
|
res.body
|
@@ -5,12 +5,12 @@ module SOULs
|
|
5
5
|
attr_accessor :schedule
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
8
|
+
def souls_post(url:, payload: {}, content_type: "application/json")
|
9
9
|
response = Faraday.post(url, payload.to_json, "Content-Type": content_type)
|
10
10
|
response.body
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def souls_check_user_permissions(user, obj, method)
|
14
14
|
raise(StandardError, "Invalid or Missing Token") unless user
|
15
15
|
|
16
16
|
policy_class = obj.class.name + "Policy"
|
@@ -46,7 +46,7 @@ module SOULs
|
|
46
46
|
File.write(file_path, Object.const_get("Template::#{runtime}").__send__(method, file_name))
|
47
47
|
SOULs::Painter.create_file(file_path)
|
48
48
|
end
|
49
|
-
create_env_yaml(file_dir:
|
49
|
+
create_env_yaml(file_dir:)
|
50
50
|
endroll = <<~TEXT
|
51
51
|
|
52
52
|
♤ Deploy Cloud Functions ♤
|
@@ -11,17 +11,17 @@ module SOULs
|
|
11
11
|
|
12
12
|
workers = SOULs.configuration.workers
|
13
13
|
port = 3000 + workers.size
|
14
|
-
download_worker(worker_name:
|
15
|
-
souls_conf_update(worker_name:
|
16
|
-
souls_conf_update(worker_name
|
17
|
-
workflow(worker_name:
|
18
|
-
procfile(worker_name
|
19
|
-
mother_procfile(worker_name:
|
20
|
-
souls_config_init(worker_name:
|
21
|
-
steepfile(worker_name:
|
22
|
-
souls_helper_rbs(worker_name:
|
14
|
+
download_worker(worker_name:)
|
15
|
+
souls_conf_update(worker_name:)
|
16
|
+
souls_conf_update(worker_name:, strain: "api")
|
17
|
+
workflow(worker_name:)
|
18
|
+
procfile(worker_name:, port:)
|
19
|
+
mother_procfile(worker_name:)
|
20
|
+
souls_config_init(worker_name:)
|
21
|
+
steepfile(worker_name:)
|
22
|
+
souls_helper_rbs(worker_name:)
|
23
23
|
system("cd #{file_dir} && bundle")
|
24
|
-
souls_worker_credit(worker_name:
|
24
|
+
souls_worker_credit(worker_name:)
|
25
25
|
end
|
26
26
|
true
|
27
27
|
end
|
@@ -137,10 +137,10 @@ end
|
|
137
137
|
|
138
138
|
steps:
|
139
139
|
- uses: actions/checkout@v2
|
140
|
-
- name: Set up Ruby 3.
|
140
|
+
- name: Set up Ruby 3.1
|
141
141
|
uses: ruby/setup-ruby@v1
|
142
142
|
with:
|
143
|
-
ruby-version:
|
143
|
+
ruby-version: 3.1
|
144
144
|
|
145
145
|
- name: Checkout the repository
|
146
146
|
uses: actions/checkout@v2
|
@@ -298,7 +298,7 @@ end
|
|
298
298
|
red2 = ["/ ___/", :red]
|
299
299
|
red3 = ["(__ )", :red]
|
300
300
|
red4 = ["/____/", :red]
|
301
|
-
ms = Paint % [txt2, :blue, { red1
|
301
|
+
ms = Paint % [txt2, :blue, { red1:, red2:, red3:, red4: }]
|
302
302
|
puts(ms)
|
303
303
|
puts(line)
|
304
304
|
welcome = Paint["SOULs Worker is Ready!", :white]
|
@@ -19,7 +19,7 @@ module SOULs
|
|
19
19
|
schedules_list = current_schedules
|
20
20
|
worker_name = FileUtils.pwd.split("/").last
|
21
21
|
Queries::BaseQuery.all_schedules.each do |k, v|
|
22
|
-
job_name = "souls-#{worker_name}-#{k}".to_sym
|
22
|
+
job_name = "souls-#{worker_name}-#{k.to_s.underscore.gsub('_', '-')}".to_sym
|
23
23
|
topic = "souls-#{worker_name}-#{k.to_s.underscore.gsub('_', '-')}"
|
24
24
|
query_name = k.to_s.gsub("-", "").camelize(:lower)
|
25
25
|
message_body = "query { #{query_name} { response }}"
|
@@ -18,7 +18,7 @@ module SOULs
|
|
18
18
|
--database-version=#{db_type} --cpu=1 --memory=4096MB --zone=#{zone} \
|
19
19
|
--root-password='#{password}' --database-flags cloudsql.iam_authentication=on"
|
20
20
|
)
|
21
|
-
SOULs::Sql.new.env(password:
|
21
|
+
SOULs::Sql.new.env(password:)
|
22
22
|
SOULs::Github.new.secret_set
|
23
23
|
SOULs::Painter.success("Cloud SQL #{instance_name} is successfully created! You can push to deploy!")
|
24
24
|
true
|
@@ -68,7 +68,7 @@ module SOULs
|
|
68
68
|
SOULS_DB_USER=postgres
|
69
69
|
SOULS_GCP_PROJECT_ID=#{project_id}
|
70
70
|
SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
|
71
|
-
TZ="#{region_to_timezone(region:
|
71
|
+
TZ="#{region_to_timezone(region:)}"
|
72
72
|
TEXT
|
73
73
|
end
|
74
74
|
SOULs::Painter.create_file(file_path)
|
@@ -85,7 +85,7 @@ module SOULs
|
|
85
85
|
SOULS_GCP_REGION=#{region}
|
86
86
|
SOULS_GCLOUDSQL_INSTANCE="#{project_id}:#{region}:#{instance_name}"
|
87
87
|
SOULS_SECRET_KEY_BASE='#{SecureRandom.base64(64)}'
|
88
|
-
TZ="#{region_to_timezone(region:
|
88
|
+
TZ="#{region_to_timezone(region:)}"
|
89
89
|
TEXT
|
90
90
|
end
|
91
91
|
SOULs::Painter.create_file(file_path)
|
@@ -19,7 +19,7 @@ module SOULs
|
|
19
19
|
file_path = "#{file_dir}/create_#{class_name}.rbs"
|
20
20
|
raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
|
21
21
|
|
22
|
-
params = SOULs.get_relation_params(class_name
|
22
|
+
params = SOULs.get_relation_params(class_name:, col: "mutation")
|
23
23
|
File.open(file_path, "w") do |f|
|
24
24
|
f.write(<<~TEXT)
|
25
25
|
class Boolean
|
@@ -107,7 +107,7 @@ module SOULs
|
|
107
107
|
file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
|
108
108
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
109
109
|
file_path = "#{file_dir}/update_#{class_name}.rbs"
|
110
|
-
params = SOULs.get_relation_params(class_name
|
110
|
+
params = SOULs.get_relation_params(class_name:, col: "mutation")
|
111
111
|
params[:params] << { column_name: "id", type: "string", array: false }
|
112
112
|
File.open(file_path, "w") do |f|
|
113
113
|
f.write(<<~TEXT)
|
@@ -63,7 +63,7 @@ module SOULs
|
|
63
63
|
new_line.write(" argument :#{name}, #{field}, required: false\n")
|
64
64
|
end
|
65
65
|
end
|
66
|
-
@on = true if SOULs.table_check(line
|
66
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -128,7 +128,7 @@ module SOULs
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
131
|
-
@on = true if SOULs.table_check(line
|
131
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
@@ -75,7 +75,7 @@ module SOULs
|
|
75
75
|
new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
|
76
76
|
end
|
77
77
|
end
|
78
|
-
@on = true if SOULs.table_check(line
|
78
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -130,7 +130,7 @@ module SOULs
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
133
|
-
@on = true if SOULs.table_check(line
|
133
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
@@ -210,7 +210,7 @@ module SOULs
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
213
|
-
@on = true if SOULs.table_check(line
|
213
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
214
214
|
end
|
215
215
|
end
|
216
216
|
end
|
@@ -262,7 +262,7 @@ module SOULs
|
|
262
262
|
end
|
263
263
|
end
|
264
264
|
end
|
265
|
-
@on = true if SOULs.table_check(line
|
265
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
266
266
|
end
|
267
267
|
end
|
268
268
|
end
|
@@ -72,7 +72,7 @@ module SOULs
|
|
72
72
|
new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
|
73
73
|
end
|
74
74
|
end
|
75
|
-
@on = true if SOULs.table_check(line
|
75
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -119,7 +119,7 @@ module SOULs
|
|
119
119
|
new_line.write(" #{name.camelize(:lower)}\n")
|
120
120
|
end
|
121
121
|
end
|
122
|
-
@on = true if SOULs.table_check(line
|
122
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -161,7 +161,7 @@ module SOULs
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
164
|
-
@on = true if SOULs.table_check(line
|
164
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
165
165
|
end
|
166
166
|
end
|
167
167
|
end
|
@@ -78,7 +78,7 @@ module SOULs
|
|
78
78
|
new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
|
79
79
|
end
|
80
80
|
end
|
81
|
-
@on = true if SOULs.table_check(line
|
81
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
@@ -134,7 +134,7 @@ module SOULs
|
|
134
134
|
new_line.write(" #{name.camelize(:lower)}\n")
|
135
135
|
end
|
136
136
|
end
|
137
|
-
@on = true if SOULs.table_check(line
|
137
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -186,7 +186,7 @@ module SOULs
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
end
|
189
|
-
@on = true if SOULs.table_check(line
|
189
|
+
@on = true if SOULs.table_check(line:, class_name:)
|
190
190
|
end
|
191
191
|
end
|
192
192
|
end
|
@@ -21,10 +21,10 @@ module SOULs
|
|
21
21
|
prompt = TTY::Prompt.new
|
22
22
|
key = prompt.ask("Set Key:")
|
23
23
|
value = prompt.ask("Set Value:")
|
24
|
-
update_env_production(key
|
25
|
-
update_api_env(key
|
26
|
-
update_workers_env(key
|
27
|
-
update_github_actions(key:
|
24
|
+
update_env_production(key:, value:, dqm: options[:dqm])
|
25
|
+
update_api_env(key:, value:, dqm: options[:dqm])
|
26
|
+
update_workers_env(key:, value:, dqm: options[:dqm])
|
27
|
+
update_github_actions(key:)
|
28
28
|
system("gh secret set #{key} -b \"#{value.strip}\"")
|
29
29
|
end
|
30
30
|
|
data/lib/souls/cli/init/index.rb
CHANGED
@@ -16,10 +16,10 @@ module SOULs
|
|
16
16
|
raise(StandardError, "Directory already exists and is not empty") if Dir.exist?(file_dir) && !Dir.empty?(file_dir)
|
17
17
|
|
18
18
|
service_name = "api"
|
19
|
-
download_souls(app_name
|
20
|
-
mother_config_init(app_name:
|
21
|
-
download_github_actions(app_name:
|
22
|
-
initial_config_init(app_name
|
19
|
+
download_souls(app_name:, service_name:)
|
20
|
+
mother_config_init(app_name:)
|
21
|
+
download_github_actions(app_name:)
|
22
|
+
initial_config_init(app_name:, service_name:)
|
23
23
|
system("cd #{app_name} && git init --initial-branch=main")
|
24
24
|
|
25
25
|
system(" cd #{app_name} && rbs collection init && rbs collection install ")
|
@@ -121,7 +121,7 @@ module SOULs
|
|
121
121
|
f.write(<<~TEXT)
|
122
122
|
source "https://rubygems.org"
|
123
123
|
|
124
|
-
gem "activesupport", "7.0.
|
124
|
+
gem "activesupport", "7.0.1"
|
125
125
|
gem "foreman", "0.87.2"
|
126
126
|
gem "google-cloud-pubsub", "2.9.0"
|
127
127
|
gem "paint", "2.2.1"
|
@@ -144,7 +144,7 @@ module SOULs
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def download_souls(app_name: "souls", service_name: "api")
|
147
|
-
version = SOULs.get_latest_version_txt(service_name:
|
147
|
+
version = SOULs.get_latest_version_txt(service_name:).join(".")
|
148
148
|
file_name = "#{service_name}-v#{version}.tgz"
|
149
149
|
url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{service_name.pluralize}/#{file_name}"
|
150
150
|
system("curl -OL #{url}")
|
@@ -184,7 +184,7 @@ module SOULs
|
|
184
184
|
red2 = ["/ ___/", :red]
|
185
185
|
red3 = ["(__ )", :red]
|
186
186
|
red4 = ["/____/", :red]
|
187
|
-
ms = Paint % [txt2, :cyan, { red1
|
187
|
+
ms = Paint % [txt2, :cyan, { red1:, red2:, red3:, red4: }]
|
188
188
|
puts(ms)
|
189
189
|
puts(line)
|
190
190
|
welcome = Paint["Welcome to SOULs!", :white]
|
@@ -20,7 +20,7 @@ module SOULs
|
|
20
20
|
choice_num = prompt.select("Select Version: ", choices)[0].to_i
|
21
21
|
update_kinds = %w[patch minor major]
|
22
22
|
update_kind = update_kinds[choice_num - 1]
|
23
|
-
souls_new_ver = SOULs.version_detector(current_ver: current_souls_ver, update_kind:
|
23
|
+
souls_new_ver = SOULs.version_detector(current_ver: current_souls_ver, update_kind:)
|
24
24
|
status = Paint["Saving Repo...", :yellow]
|
25
25
|
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
26
26
|
Whirly.status = status
|
@@ -37,7 +37,7 @@ module SOULs
|
|
37
37
|
puts("before build")
|
38
38
|
system("rake build")
|
39
39
|
system("rake release")
|
40
|
-
write_changelog(current_souls_ver:
|
40
|
+
write_changelog(current_souls_ver:)
|
41
41
|
system("gh release create v#{souls_new_ver} -t v#{souls_new_ver} -F ./CHANGELOG.md")
|
42
42
|
system("gsutil -m -q -o 'GSUtil:parallel_process_count=1' cp -r coverage gs://souls-bucket/souls-coverage")
|
43
43
|
system("bundle exec rake upload:init_files")
|
@@ -168,7 +168,7 @@ module SOULs
|
|
168
168
|
end
|
169
169
|
TEXT
|
170
170
|
end
|
171
|
-
overwrite_gemfile_lock(new_version:
|
171
|
+
overwrite_gemfile_lock(new_version:)
|
172
172
|
true
|
173
173
|
rescue StandardError, e
|
174
174
|
raise(StandardError, e)
|
data/lib/souls/cli/sync/model.rb
CHANGED
@@ -16,7 +16,7 @@ module SOULs
|
|
16
16
|
|
17
17
|
worker_file_names = get_workers_file_paths
|
18
18
|
|
19
|
-
sync_pubsub_topics_and_subscriptions(worker_file_names
|
19
|
+
sync_pubsub_topics_and_subscriptions(worker_file_names:, worker_url: url)
|
20
20
|
SOULs::Painter.sync("All Jobs with PubSub Subscription!")
|
21
21
|
end
|
22
22
|
|
@@ -24,7 +24,7 @@ module SOULs
|
|
24
24
|
|
25
25
|
def sync_pubsub_topics_and_subscriptions(worker_url:, worker_file_names: {})
|
26
26
|
project_id = SOULs.configuration.project_id
|
27
|
-
pubsub = Google::Cloud::Pubsub.new(project_id:
|
27
|
+
pubsub = Google::Cloud::Pubsub.new(project_id:)
|
28
28
|
topics = pubsub.topics
|
29
29
|
worker_name = FileUtils.pwd.split("/").last
|
30
30
|
|
@@ -45,18 +45,18 @@ module SOULs
|
|
45
45
|
return if souls_topics.blank?
|
46
46
|
|
47
47
|
souls_topics.each do |topic_id|
|
48
|
-
delete_topic(topic_id:
|
49
|
-
delete_subscription(topic_id:
|
48
|
+
delete_topic(topic_id:)
|
49
|
+
delete_subscription(topic_id:)
|
50
50
|
end
|
51
51
|
else
|
52
52
|
worker_file_names.each do |key, value|
|
53
53
|
topic_id = key.to_s.gsub("_", "-")
|
54
54
|
if value == 1
|
55
|
-
create_topic(topic_id:
|
56
|
-
create_push_subscription(worker_url
|
55
|
+
create_topic(topic_id:)
|
56
|
+
create_push_subscription(worker_url:, topic_id:)
|
57
57
|
end
|
58
|
-
delete_topic(topic_id:
|
59
|
-
delete_subscription(topic_id:
|
58
|
+
delete_topic(topic_id:) if value == -1
|
59
|
+
delete_subscription(topic_id:) if value == -1
|
60
60
|
end
|
61
61
|
end
|
62
62
|
worker_file_names
|
@@ -64,14 +64,14 @@ module SOULs
|
|
64
64
|
|
65
65
|
def create_topic(topic_id: "worker-mailer")
|
66
66
|
project_id = SOULs.configuration.project_id
|
67
|
-
pubsub = Google::Cloud::Pubsub.new(project_id:
|
67
|
+
pubsub = Google::Cloud::Pubsub.new(project_id:)
|
68
68
|
topic = pubsub.create_topic(topic_id.to_s)
|
69
69
|
SOULs::Painter.success("Topic #{topic.name} created.")
|
70
70
|
end
|
71
71
|
|
72
72
|
def delete_topic(topic_id: "worker-mailer")
|
73
73
|
project_id = SOULs.configuration.project_id
|
74
|
-
pubsub = Google::Cloud::Pubsub.new(project_id:
|
74
|
+
pubsub = Google::Cloud::Pubsub.new(project_id:)
|
75
75
|
topic = pubsub.topic(topic_id.to_s)
|
76
76
|
topic.delete
|
77
77
|
SOULs::Painter.warning("Topic #{topic_id} deleted.", "✨")
|
@@ -79,7 +79,7 @@ module SOULs
|
|
79
79
|
|
80
80
|
def delete_subscription(topic_id: "worker-mailer")
|
81
81
|
project_id = SOULs.configuration.project_id
|
82
|
-
pubsub = Google::Cloud::Pubsub.new(project_id:
|
82
|
+
pubsub = Google::Cloud::Pubsub.new(project_id:)
|
83
83
|
subscription_id = "#{topic_id}-sub"
|
84
84
|
subscription = pubsub.subscription(subscription_id)
|
85
85
|
subscription.delete
|
@@ -91,10 +91,10 @@ module SOULs
|
|
91
91
|
endpoint = "#{worker_url}#{souls_endpoint}"
|
92
92
|
|
93
93
|
project_id = SOULs.configuration.project_id
|
94
|
-
pubsub = Google::Cloud::Pubsub.new(project_id:
|
94
|
+
pubsub = Google::Cloud::Pubsub.new(project_id:)
|
95
95
|
|
96
96
|
topic = pubsub.topic(topic_id)
|
97
|
-
sub = topic.subscribe(subscription_id, endpoint
|
97
|
+
sub = topic.subscribe(subscription_id, endpoint:, deadline: 20)
|
98
98
|
sub.expires_in = nil
|
99
99
|
SOULs::Painter.success("Push subscription #{subscription_id} created.")
|
100
100
|
end
|
@@ -14,7 +14,7 @@ module SOULs
|
|
14
14
|
end
|
15
15
|
|
16
16
|
mutation_argument = check_mutation_argument(class_name: "user", action: "create")
|
17
|
-
overwrite_class_file(mutation_argument
|
17
|
+
overwrite_class_file(mutation_argument:, file_path:, new_cols:)
|
18
18
|
SOULs::Painter.update_file(file_path.to_s)
|
19
19
|
end
|
20
20
|
|
@@ -29,8 +29,8 @@ module SOULs
|
|
29
29
|
return
|
30
30
|
end
|
31
31
|
|
32
|
-
mutation_argument = check_mutation_argument(class_name
|
33
|
-
overwrite_class_file(mutation_argument
|
32
|
+
mutation_argument = check_mutation_argument(class_name:, action: "update")
|
33
|
+
overwrite_class_file(mutation_argument:, file_path:, new_cols:)
|
34
34
|
|
35
35
|
SOULs::Painter.update_file(file_path.to_s)
|
36
36
|
end
|
@@ -7,8 +7,8 @@ module SOULs
|
|
7
7
|
dir_name = "./app/graphql/resolvers"
|
8
8
|
new_file_path = "tmp/update_resolver.rb"
|
9
9
|
file_path = "#{dir_name}/#{singularized_class_name}_search.rb"
|
10
|
-
args = check_resolver_argument(class_name:
|
11
|
-
scope_args = check_resolver_argument(class_name
|
10
|
+
args = check_resolver_argument(class_name:)
|
11
|
+
scope_args = check_resolver_argument(class_name:, action: "scope")
|
12
12
|
argument = false
|
13
13
|
scope = false
|
14
14
|
File.open(file_path) do |f|
|
@@ -20,7 +20,7 @@ module SOULs
|
|
20
20
|
|
21
21
|
type = SOULs.get_test_type(col[:type])
|
22
22
|
type = "[#{type}]" if col[:array]
|
23
|
-
args = check_factory_argument(class_name:
|
23
|
+
args = check_factory_argument(class_name:)
|
24
24
|
|
25
25
|
new_line.write(" #{col[:column_name]} { #{type} }\n") unless args.include?(col[:column_name])
|
26
26
|
end
|
@@ -32,12 +32,12 @@ module SOULs
|
|
32
32
|
" #{col[:column_name].camelize(:lower)}" \
|
33
33
|
": \#{#{class_name}[:#{col[:column_name].underscore}]}\n"
|
34
34
|
end
|
35
|
-
args = check_rspec_mutation_argument(class_name:
|
35
|
+
args = check_rspec_mutation_argument(class_name:)
|
36
36
|
new_line.write(type_line) unless args.include?(col[:column_name].underscore)
|
37
37
|
end
|
38
38
|
argument = true
|
39
39
|
elsif node_res && !line.include?("{")
|
40
|
-
node_args = check_rspec_mutation_argument(class_name
|
40
|
+
node_args = check_rspec_mutation_argument(class_name:, action: "node_args")
|
41
41
|
new_cols.each do |col|
|
42
42
|
unless node_args.include?(col[:column_name])
|
43
43
|
new_line.write(" #{col[:column_name].camelize(:lower)}\n")
|
@@ -45,7 +45,7 @@ module SOULs
|
|
45
45
|
end
|
46
46
|
node_res = false
|
47
47
|
elsif test_res && line.include?("=> be_")
|
48
|
-
test_args = check_rspec_mutation_argument(class_name
|
48
|
+
test_args = check_rspec_mutation_argument(class_name:, action: "test_args")
|
49
49
|
new_cols.each do |col|
|
50
50
|
type = SOULs.type_check(col[:type])
|
51
51
|
text =
|
@@ -19,7 +19,7 @@ module SOULs
|
|
19
19
|
test_res = false if test_res && line.strip == ")"
|
20
20
|
|
21
21
|
if node_res && !line.include?("{")
|
22
|
-
node_args = check_rspec_resolver_argument(class_name
|
22
|
+
node_args = check_rspec_resolver_argument(class_name:, action: "node_args")
|
23
23
|
new_cols.each do |col|
|
24
24
|
unless node_args.include?(col[:column_name])
|
25
25
|
new_line.write(" #{col[:column_name].camelize(:lower)}\n")
|
@@ -27,7 +27,7 @@ module SOULs
|
|
27
27
|
end
|
28
28
|
node_res = false
|
29
29
|
elsif test_res && line.include?("=> be_")
|
30
|
-
test_args = check_rspec_resolver_argument(class_name
|
30
|
+
test_args = check_rspec_resolver_argument(class_name:, action: "test_args")
|
31
31
|
new_cols.each do |col|
|
32
32
|
type = SOULs.type_check(col[:type])
|
33
33
|
text =
|
@@ -17,7 +17,7 @@ module SOULs
|
|
17
17
|
new_cols.each do |col|
|
18
18
|
type = SOULs.get_type(col[:type])
|
19
19
|
type = "[#{type}]" if col[:array]
|
20
|
-
args = check_type_argument(class_name:
|
20
|
+
args = check_type_argument(class_name:)
|
21
21
|
unless args.include?(col[:column_name])
|
22
22
|
new_line.write(" field :#{col[:column_name]}, #{type}, null: true\n")
|
23
23
|
end
|
data/lib/souls/utils/index.rb
CHANGED
@@ -122,9 +122,9 @@ module SOULs
|
|
122
122
|
Dir.chdir(SOULs.get_api_path.to_s) do
|
123
123
|
cols =
|
124
124
|
if col == "mutation"
|
125
|
-
get_columns_num_no_timestamp(class_name:
|
125
|
+
get_columns_num_no_timestamp(class_name:)
|
126
126
|
else
|
127
|
-
get_columns_num(class_name:
|
127
|
+
get_columns_num(class_name:)
|
128
128
|
end
|
129
129
|
relation_params = cols.select { |n| n[:column_name].match?(/_id$/) }
|
130
130
|
user_check =
|
@@ -132,7 +132,7 @@ module SOULs
|
|
132
132
|
param[:column_name] == "user_id"
|
133
133
|
end
|
134
134
|
user_exist = user_check.include?(true)
|
135
|
-
return { user_exist
|
135
|
+
return { user_exist:, params: cols, relation_params: }
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -149,7 +149,7 @@ module SOULs
|
|
149
149
|
|
150
150
|
types = SOULs.get_type_and_name(line)
|
151
151
|
array = line.include?("array: true")
|
152
|
-
cols << { column_name: types[1], type: types[0], array:
|
152
|
+
cols << { column_name: types[1], type: types[0], array: }
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
@@ -169,7 +169,7 @@ module SOULs
|
|
169
169
|
|
170
170
|
types = SOULs.get_type_and_name(line)
|
171
171
|
array = line.include?("array: true")
|
172
|
-
cols << { column_name: types[1], type: types[0], array:
|
172
|
+
cols << { column_name: types[1], type: types[0], array: } unless %w[
|
173
173
|
created_at
|
174
174
|
updated_at
|
175
175
|
].include?(types[1])
|
@@ -197,7 +197,7 @@ module SOULs
|
|
197
197
|
types = SOULs.get_type_and_name(line)
|
198
198
|
types.map { |n| n.gsub!(":", "") }
|
199
199
|
array = line.include?("array: true")
|
200
|
-
response << { column_name: types[1], type: types[0], array:
|
200
|
+
response << { column_name: types[1], type: types[0], array: }
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|
@@ -208,7 +208,7 @@ module SOULs
|
|
208
208
|
|
209
209
|
new_columns =
|
210
210
|
file_paths.map do |file_path|
|
211
|
-
get_col_name_and_type(class_name
|
211
|
+
get_col_name_and_type(class_name:, file_path:, action:)
|
212
212
|
end
|
213
213
|
new_columns.flatten
|
214
214
|
end
|
@@ -230,17 +230,17 @@ module SOULs
|
|
230
230
|
raise(StandardError, "Wrong class_name!Please Check your migration file!")
|
231
231
|
end
|
232
232
|
|
233
|
-
response << { column_name: types[1], type: types[2], array:
|
233
|
+
response << { column_name: types[1], type: types[2], array: }
|
234
234
|
end
|
235
235
|
end
|
236
236
|
response
|
237
237
|
end
|
238
238
|
|
239
239
|
def check_schema(class_name: "user")
|
240
|
-
schema_data = get_columns_num(class_name:
|
241
|
-
create_migration_data = get_create_migration_type(class_name:
|
242
|
-
add_migration_data = get_migration_type(class_name
|
243
|
-
remove_migration_data = get_migration_type(class_name
|
240
|
+
schema_data = get_columns_num(class_name:)
|
241
|
+
create_migration_data = get_create_migration_type(class_name:)
|
242
|
+
add_migration_data = get_migration_type(class_name:, action: "add")
|
243
|
+
remove_migration_data = get_migration_type(class_name:, action: "remove")
|
244
244
|
migration_data = create_migration_data + add_migration_data - remove_migration_data
|
245
245
|
return "Already Up to date!" if schema_data.size == migration_data.size
|
246
246
|
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.21.1
|
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.21.1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: souls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-01-
|
13
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 7.0.
|
21
|
+
version: 7.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 7.0.
|
28
|
+
version: 7.0.1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: foreman
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -307,14 +307,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
307
307
|
requirements:
|
308
308
|
- - ">="
|
309
309
|
- !ruby/object:Gem::Version
|
310
|
-
version: 3.
|
310
|
+
version: 3.1.0
|
311
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
312
312
|
requirements:
|
313
313
|
- - ">="
|
314
314
|
- !ruby/object:Gem::Version
|
315
315
|
version: '0'
|
316
316
|
requirements: []
|
317
|
-
rubygems_version: 3.
|
317
|
+
rubygems_version: 3.3.3
|
318
318
|
signing_key:
|
319
319
|
specification_version: 4
|
320
320
|
summary: Ruby Serverless Framework 'SOULs' | Ruby サーバーレスフレームワーク SOULs. Powered by
|