souls 1.17.2 → 1.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/exe/souls +2 -2
- data/lib/souls/app/graphql/souls_connection.rb +2 -2
- data/lib/souls/app/graphql/souls_mutation.rb +21 -12
- data/lib/souls/app/graphql/souls_query.rb +11 -2
- data/lib/souls/app/graphql/types/base_argument.rb +1 -1
- data/lib/souls/app/graphql/types/base_enum.rb +1 -1
- data/lib/souls/app/graphql/types/base_field.rb +2 -2
- data/lib/souls/app/graphql/types/base_input_object.rb +2 -2
- data/lib/souls/app/graphql/types/base_interface.rb +2 -2
- data/lib/souls/app/graphql/types/base_object.rb +14 -3
- data/lib/souls/app/graphql/types/base_scalar.rb +1 -1
- data/lib/souls/app/graphql/types/base_union.rb +1 -1
- data/lib/souls/app/graphql/types/index.rb +1 -1
- data/lib/souls/app/graphql/types/mutation_object.rb +29 -0
- data/lib/souls/app/graphql/types/query_object.rb +16 -0
- data/lib/souls/app/index.rb +1 -1
- data/lib/souls/app/utils/painter.rb +1 -1
- data/lib/souls/app/utils/souls_logger.rb +3 -3
- data/lib/souls/cli/cli_exception.rb +1 -1
- data/lib/souls/cli/console/index.rb +1 -1
- data/lib/souls/cli/create/functions.rb +5 -5
- data/lib/souls/cli/create/index.rb +13 -13
- data/lib/souls/cli/db/create_migration.rb +5 -5
- data/lib/souls/cli/db/create_migration_rbs.rb +3 -3
- data/lib/souls/cli/db/index.rb +2 -2
- data/lib/souls/cli/db/model.rb +2 -2
- data/lib/souls/cli/db/model_rbs.rb +3 -3
- data/lib/souls/cli/db/rspec_model.rb +2 -2
- data/lib/souls/cli/delete/application.rb +3 -3
- data/lib/souls/cli/delete/connection.rb +2 -2
- data/lib/souls/cli/delete/connection_rbs.rb +3 -3
- data/lib/souls/cli/delete/edge.rb +2 -2
- data/lib/souls/cli/delete/edge_rbs.rb +3 -3
- data/lib/souls/cli/delete/index.rb +1 -1
- data/lib/souls/cli/delete/job.rb +4 -4
- data/lib/souls/cli/delete/job_rbs.rb +4 -4
- data/lib/souls/cli/delete/manager.rb +4 -4
- data/lib/souls/cli/delete/manager_rbs.rb +3 -3
- data/lib/souls/cli/delete/migration_file.rb +3 -3
- data/lib/souls/cli/delete/mutation.rb +3 -3
- data/lib/souls/cli/delete/mutation_rbs.rb +3 -3
- data/lib/souls/cli/delete/query.rb +2 -2
- data/lib/souls/cli/delete/query_rbs.rb +3 -3
- data/lib/souls/cli/delete/resolver.rb +2 -2
- data/lib/souls/cli/delete/resolver_rbs.rb +3 -3
- data/lib/souls/cli/delete/rspec_factory.rb +2 -2
- data/lib/souls/cli/delete/rspec_job.rb +2 -2
- data/lib/souls/cli/delete/rspec_manager.rb +2 -2
- data/lib/souls/cli/delete/rspec_mutation.rb +2 -2
- data/lib/souls/cli/delete/rspec_query.rb +2 -2
- data/lib/souls/cli/delete/rspec_resolver.rb +2 -2
- data/lib/souls/cli/delete/type.rb +2 -2
- data/lib/souls/cli/delete/type_rbs.rb +3 -3
- data/lib/souls/cli/docker/index.rb +1 -1
- data/lib/souls/cli/gcloud/compute/index.rb +24 -24
- data/lib/souls/cli/gcloud/functions/index.rb +18 -18
- data/lib/souls/cli/gcloud/iam/index.rb +12 -12
- data/lib/souls/cli/gcloud/index.rb +5 -5
- data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +3 -3
- data/lib/souls/cli/gcloud/pubsub/topics.rb +1 -1
- data/lib/souls/cli/gcloud/run/index.rb +1 -1
- data/lib/souls/cli/gcloud/scheduler/index.rb +4 -4
- data/lib/souls/cli/gcloud/sql/index.rb +17 -17
- data/lib/souls/cli/generate/application.rb +4 -4
- data/lib/souls/cli/generate/connection.rb +2 -2
- data/lib/souls/cli/generate/connection_rbs.rb +3 -3
- data/lib/souls/cli/generate/edge.rb +2 -2
- data/lib/souls/cli/generate/edge_rbs.rb +3 -3
- data/lib/souls/cli/generate/index.rb +1 -1
- data/lib/souls/cli/generate/job.rb +9 -9
- data/lib/souls/cli/generate/job_rbs.rb +4 -4
- data/lib/souls/cli/generate/manager.rb +4 -4
- data/lib/souls/cli/generate/manager_rbs.rb +3 -3
- data/lib/souls/cli/generate/mutation.rb +15 -15
- data/lib/souls/cli/generate/mutation_rbs.rb +17 -17
- data/lib/souls/cli/generate/query.rb +3 -3
- data/lib/souls/cli/generate/query_rbs.rb +3 -3
- data/lib/souls/cli/generate/resolver.rb +8 -8
- data/lib/souls/cli/generate/resolver_rbs.rb +3 -3
- data/lib/souls/cli/generate/rspec_factory.rb +4 -4
- data/lib/souls/cli/generate/rspec_job.rb +4 -4
- data/lib/souls/cli/generate/rspec_manager.rb +3 -3
- data/lib/souls/cli/generate/rspec_mutation.rb +9 -9
- data/lib/souls/cli/generate/rspec_query.rb +7 -7
- data/lib/souls/cli/generate/rspec_resolver.rb +7 -7
- data/lib/souls/cli/generate/type.rb +5 -5
- data/lib/souls/cli/generate/type_rbs.rb +6 -6
- data/lib/souls/cli/github/index.rb +13 -13
- data/lib/souls/cli/index.rb +1 -1
- data/lib/souls/cli/init/index.rb +8 -8
- data/lib/souls/cli/release/release.rb +8 -8
- data/lib/souls/cli/server/index.rb +2 -2
- data/lib/souls/cli/sync/conf.rb +8 -8
- data/lib/souls/cli/sync/model.rb +13 -11
- data/lib/souls/cli/sync/pubsub.rb +9 -9
- data/lib/souls/cli/update/index.rb +2 -2
- data/lib/souls/cli/update/mutation.rb +8 -8
- data/lib/souls/cli/update/mutation_rbs.rb +11 -11
- data/lib/souls/cli/update/resolver.rb +5 -5
- data/lib/souls/cli/update/rspec_factory.rb +4 -4
- data/lib/souls/cli/update/rspec_mutation.rb +5 -5
- data/lib/souls/cli/update/rspec_resolver.rb +4 -4
- data/lib/souls/cli/update/type.rb +4 -4
- data/lib/souls/cli/update/type_rbs.rb +5 -5
- data/lib/souls/cli/upgrade/config.rb +3 -3
- data/lib/souls/cli/upgrade/gemfile.rb +4 -4
- data/lib/souls/cli/upgrade/submodule.rb +1 -1
- data/lib/souls/cli.rb +5 -5
- data/lib/souls/index.rb +1 -1
- data/lib/souls/souls_path.rb +2 -2
- data/lib/souls/utils/index.rb +7 -7
- data/lib/souls/version.rb +2 -2
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- data/lib/souls.rb +2 -2
- metadata +3 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "query_rbs [CLASS_NAME]", "Generate GraphQL Query RBS"
|
4
4
|
def query_rbs(class_name)
|
@@ -9,7 +9,7 @@ module Souls
|
|
9
9
|
|
10
10
|
def single_query_rbs(class_name)
|
11
11
|
file_path = ""
|
12
|
-
Dir.chdir(
|
12
|
+
Dir.chdir(SOULs.get_mother_path.to_s) do
|
13
13
|
file_dir = "./sig/api/app/graphql/queries/"
|
14
14
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
15
15
|
singularized_class_name = class_name.underscore.singularize
|
@@ -30,7 +30,7 @@ module Souls
|
|
30
30
|
end
|
31
31
|
TEXT
|
32
32
|
end
|
33
|
-
|
33
|
+
SOULs::Painter.create_file(file_path.to_s)
|
34
34
|
end
|
35
35
|
file_path
|
36
36
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "resolver [CLASS_NAME]", "Generate GraphQL Resolver from schema.rb"
|
4
4
|
def resolver(class_name)
|
@@ -11,7 +11,7 @@ module Souls
|
|
11
11
|
resolver_after_params(class_name: singularized_class_name)
|
12
12
|
resolver_before_end(class_name: singularized_class_name)
|
13
13
|
resolver_end(class_name: singularized_class_name)
|
14
|
-
|
14
|
+
SOULs::Painter.create_file(file_path.to_s)
|
15
15
|
file_path
|
16
16
|
end
|
17
17
|
|
@@ -30,7 +30,7 @@ module Souls
|
|
30
30
|
type Types::#{class_name.camelize}Type.connection_type, null: false
|
31
31
|
description "Search #{class_name.camelize}"
|
32
32
|
|
33
|
-
class #{class_name.camelize}Filter <
|
33
|
+
class #{class_name.camelize}Filter < SOULs::Types::BaseInputObject
|
34
34
|
argument :OR, [self], required: false
|
35
35
|
TEXT
|
36
36
|
end
|
@@ -49,8 +49,8 @@ module Souls
|
|
49
49
|
break if line.include?("t.index") || line.strip == "end"
|
50
50
|
|
51
51
|
field = "[String]" if line.include?("array: true")
|
52
|
-
type, name =
|
53
|
-
field ||=
|
52
|
+
type, name = SOULs.get_type_and_name(line)
|
53
|
+
field ||= SOULs.type_check(type)
|
54
54
|
case name
|
55
55
|
when "user_id"
|
56
56
|
@user_exist = true
|
@@ -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
|
66
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -102,7 +102,7 @@ module Souls
|
|
102
102
|
if @on
|
103
103
|
break if line.include?("t.index") || line.strip == "end"
|
104
104
|
|
105
|
-
type, name =
|
105
|
+
type, name = SOULs.get_type_and_name(line)
|
106
106
|
if line.include?("array: true")
|
107
107
|
new_line.write(
|
108
108
|
" scope = scope.where(\"#{name} @> ARRAY[?]::text[]\", value[:#{name}]) if value[:#{name}]\n"
|
@@ -128,7 +128,7 @@ module Souls
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
131
|
-
@on = true if
|
131
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "resolver_rbs [CLASS_NAME]", "Generate GraphQL Resolver RBS from schema.rb"
|
4
4
|
def resolver_rbs(class_name)
|
5
5
|
singularized_class_name = class_name.underscore.singularize
|
6
6
|
file_path = ""
|
7
|
-
Dir.chdir(
|
7
|
+
Dir.chdir(SOULs.get_mother_path.to_s) do
|
8
8
|
file_dir = "./sig/api/app/graphql/resolvers"
|
9
9
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
10
10
|
file_path = "#{file_dir}/#{singularized_class_name}_search.rbs"
|
@@ -35,7 +35,7 @@ module Souls
|
|
35
35
|
TEXT
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
SOULs::Painter.create_file(file_path.to_s)
|
39
39
|
file_path
|
40
40
|
end
|
41
41
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "rspec_factory [CLASS_NAME]", "Generate Rspec Factory Test from schema.rb"
|
4
4
|
def rspec_factory(class_name)
|
@@ -9,7 +9,7 @@ module Souls
|
|
9
9
|
rspec_factory_head(class_name: singularized_class_name)
|
10
10
|
rspec_factory_params(class_name: singularized_class_name)
|
11
11
|
rspec_factory_end(class_name: singularized_class_name)
|
12
|
-
|
12
|
+
SOULs::Painter.create_file(file_path.to_s)
|
13
13
|
file_path
|
14
14
|
end
|
15
15
|
|
@@ -37,7 +37,7 @@ module Souls
|
|
37
37
|
new_line.write("\n" && break) if line.include?("t.index") || line.strip == "end"
|
38
38
|
field = '["tag1", "tag2", "tag3"]' if line.include?("array: true")
|
39
39
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
40
|
-
field ||=
|
40
|
+
field ||= SOULs.get_test_type(type)
|
41
41
|
if type == "bigint" && name.include?("_id")
|
42
42
|
id_name = name.gsub("_id", "")
|
43
43
|
new_line.write(" association :#{id_name}, factory: :#{id_name}\n")
|
@@ -45,7 +45,7 @@ module Souls
|
|
45
45
|
new_line.write(" #{name} { #{field} }\n")
|
46
46
|
end
|
47
47
|
end
|
48
|
-
@on = true if
|
48
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "rspec_job [CLASS_NAME]", "Generate Rspec Job Test Template"
|
4
4
|
method_option :mailer, type: :boolean, aliases: "--mailer", default: false, desc: "Mailgun Template"
|
@@ -25,7 +25,7 @@ module Souls
|
|
25
25
|
end
|
26
26
|
|
27
27
|
subject(:result) do
|
28
|
-
|
28
|
+
SOULsApiSchema.execute(query).as_json
|
29
29
|
end
|
30
30
|
|
31
31
|
it "return #{singularized_class_name.camelize} response" do
|
@@ -54,7 +54,7 @@ module Souls
|
|
54
54
|
end
|
55
55
|
|
56
56
|
subject(:result) do
|
57
|
-
|
57
|
+
SOULsApiSchema.execute(query).as_json
|
58
58
|
end
|
59
59
|
|
60
60
|
it "return #{singularized_class_name.camelize} response" do
|
@@ -67,7 +67,7 @@ module Souls
|
|
67
67
|
TEXT
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
70
|
+
SOULs::Painter.create_file(file_path.to_s)
|
71
71
|
file_path
|
72
72
|
end
|
73
73
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "rspec_manager [CLASS_NAME]", "Generate Rspec Manager Test Template"
|
4
4
|
method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
|
@@ -26,7 +26,7 @@ module Souls
|
|
26
26
|
end
|
27
27
|
|
28
28
|
subject(:result) do
|
29
|
-
|
29
|
+
SOULsApiSchema.execute(mutation).as_json
|
30
30
|
end
|
31
31
|
|
32
32
|
it "return User response" do
|
@@ -42,7 +42,7 @@ module Souls
|
|
42
42
|
end
|
43
43
|
TEXT
|
44
44
|
end
|
45
|
-
|
45
|
+
SOULs::Painter.create_file(file_path.to_s)
|
46
46
|
file_path
|
47
47
|
end
|
48
48
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "rspec_mutation [CLASS_NAME]", "Generate Rspec Mutation Test from schema.rb"
|
4
4
|
def rspec_mutation(class_name)
|
@@ -11,7 +11,7 @@ module Souls
|
|
11
11
|
rspec_mutation_params(class_name: singularized_class_name)
|
12
12
|
rspec_mutation_params_response(class_name: singularized_class_name)
|
13
13
|
rspec_mutation_end(class_name: singularized_class_name)
|
14
|
-
|
14
|
+
SOULs::Painter.create_file(file_path.to_s)
|
15
15
|
file_path
|
16
16
|
rescue StandardError => e
|
17
17
|
raise(StandardError, e)
|
@@ -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
|
78
|
+
@on = true if SOULs.table_check(line: line, class_name: 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
|
133
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
@@ -158,7 +158,7 @@ module Souls
|
|
158
158
|
context = {
|
159
159
|
user: user
|
160
160
|
}
|
161
|
-
|
161
|
+
SOULsApiSchema.execute(mutation, context: context).as_json
|
162
162
|
end
|
163
163
|
|
164
164
|
it "return #{class_name.camelize} Data" do
|
@@ -181,7 +181,7 @@ module Souls
|
|
181
181
|
end
|
182
182
|
|
183
183
|
subject(:result) do
|
184
|
-
|
184
|
+
SOULsApiSchema.execute(mutation).as_json
|
185
185
|
end
|
186
186
|
|
187
187
|
it "return #{class_name.camelize} Data" do
|
@@ -210,7 +210,7 @@ module Souls
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
213
|
-
@on = true if
|
213
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
214
214
|
end
|
215
215
|
end
|
216
216
|
end
|
@@ -234,7 +234,7 @@ module Souls
|
|
234
234
|
break
|
235
235
|
end
|
236
236
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
237
|
-
field ||=
|
237
|
+
field ||= SOULs.type_check(type)
|
238
238
|
array_true = line.include?("array: true")
|
239
239
|
case name
|
240
240
|
when "user_id", "created_at", "updated_at", /$*_id\z/
|
@@ -262,7 +262,7 @@ module Souls
|
|
262
262
|
end
|
263
263
|
end
|
264
264
|
end
|
265
|
-
@on = true if
|
265
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
266
266
|
end
|
267
267
|
end
|
268
268
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "rspec_query [CLASS_NAME]", "Generate Rspec Query Test from schema.rb"
|
4
4
|
def rspec_query(class_name)
|
@@ -10,7 +10,7 @@ module Souls
|
|
10
10
|
rspec_query_after_head(singularized_class_name)
|
11
11
|
rspec_query_params(singularized_class_name)
|
12
12
|
rspec_query_end(singularized_class_name)
|
13
|
-
|
13
|
+
SOULs::Painter.create_file(file_path.to_s)
|
14
14
|
file_path
|
15
15
|
end
|
16
16
|
|
@@ -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
|
75
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -96,7 +96,7 @@ module Souls
|
|
96
96
|
end
|
97
97
|
|
98
98
|
subject(:result) do
|
99
|
-
|
99
|
+
SOULsApiSchema.execute(query).as_json
|
100
100
|
end
|
101
101
|
|
102
102
|
it "return #{class_name.camelize} Data" do
|
@@ -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
|
122
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -143,7 +143,7 @@ module Souls
|
|
143
143
|
break
|
144
144
|
end
|
145
145
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
146
|
-
field ||=
|
146
|
+
field ||= SOULs.type_check(type)
|
147
147
|
array_true = line.include?("array: true")
|
148
148
|
case name
|
149
149
|
when "user_id", "created_at", "updated_at", /$*_id\z/
|
@@ -161,7 +161,7 @@ module Souls
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
164
|
-
@on = true if
|
164
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
165
165
|
end
|
166
166
|
end
|
167
167
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "rspec_resolver [CLASS_NAME]", "Generate Rspec Resolver Test from schema.rb"
|
4
4
|
def rspec_resolver(class_name)
|
@@ -10,7 +10,7 @@ module Souls
|
|
10
10
|
rspec_resolver_after_head(singularized_class_name)
|
11
11
|
rspec_resolver_params(singularized_class_name)
|
12
12
|
rspec_resolver_end(singularized_class_name)
|
13
|
-
|
13
|
+
SOULs::Painter.create_file(file_path.to_s)
|
14
14
|
file_path
|
15
15
|
end
|
16
16
|
|
@@ -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
|
81
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
@@ -111,7 +111,7 @@ module Souls
|
|
111
111
|
end
|
112
112
|
|
113
113
|
subject(:result) do
|
114
|
-
|
114
|
+
SOULsApiSchema.execute(query).as_json
|
115
115
|
end
|
116
116
|
|
117
117
|
it "return #{class_name.camelize} Data" do
|
@@ -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
|
137
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -158,7 +158,7 @@ module Souls
|
|
158
158
|
break
|
159
159
|
end
|
160
160
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
161
|
-
field ||=
|
161
|
+
field ||= SOULs.type_check(type)
|
162
162
|
array_true = line.include?("array: true")
|
163
163
|
case name
|
164
164
|
when "user_id", "created_at", "updated_at", /$*_id\z/
|
@@ -186,7 +186,7 @@ module Souls
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
end
|
189
|
-
@on = true if
|
189
|
+
@on = true if SOULs.table_check(line: line, class_name: class_name)
|
190
190
|
end
|
191
191
|
end
|
192
192
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "type [CLASS_NAME]", "Generate GraphQL Type from schema.rb"
|
4
4
|
def type(class_name)
|
@@ -9,7 +9,7 @@ module Souls
|
|
9
9
|
create_type_head(class_name: singularized_class_name)
|
10
10
|
create_type_params(class_name: singularized_class_name)
|
11
11
|
create_type_end(class_name: singularized_class_name)
|
12
|
-
|
12
|
+
SOULs::Painter.create_file(file_path.to_s)
|
13
13
|
file_path
|
14
14
|
end
|
15
15
|
|
@@ -22,7 +22,7 @@ module Souls
|
|
22
22
|
File.open(file_path, "w") do |f|
|
23
23
|
f.write(<<~TEXT)
|
24
24
|
module Types
|
25
|
-
class #{class_name.camelize}Type <
|
25
|
+
class #{class_name.camelize}Type < SOULs::Types::BaseObject
|
26
26
|
implements GraphQL::Types::Relay::Node
|
27
27
|
|
28
28
|
TEXT
|
@@ -40,7 +40,7 @@ module Souls
|
|
40
40
|
new_line.write("\n" && break) if line.include?("t.index") || line.strip == "end"
|
41
41
|
field = "[String]" if line.include?("array: true")
|
42
42
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
43
|
-
field ||=
|
43
|
+
field ||= SOULs.type_check(type)
|
44
44
|
case name
|
45
45
|
when /$*_id\z/
|
46
46
|
new_line.write(
|
@@ -53,7 +53,7 @@ module Souls
|
|
53
53
|
new_line.write(" field :#{name}, #{field}, null: true\n")
|
54
54
|
end
|
55
55
|
end
|
56
|
-
if
|
56
|
+
if SOULs.table_check(line: line, class_name: class_name)
|
57
57
|
@on = true
|
58
58
|
new_line.write(" global_id_field :id\n")
|
59
59
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Generate < Thor
|
3
3
|
desc "type_rbs [CLASS_NAME]", "Generate GraphQL Type RBS from schema.rb"
|
4
4
|
def type_rbs(class_name)
|
5
5
|
singularized_class_name = class_name.underscore.singularize
|
6
6
|
file_path = ""
|
7
|
-
Dir.chdir(
|
7
|
+
Dir.chdir(SOULs.get_mother_path.to_s) do
|
8
8
|
file_dir = "./sig/api/app/graphql/types"
|
9
9
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
10
10
|
file_path = "#{file_dir}/#{singularized_class_name}_type.rbs"
|
11
11
|
raise(Thor::Error, "Type RBS already exist! #{file_path}") if File.exist?(file_path)
|
12
12
|
|
13
|
-
params =
|
13
|
+
params = SOULs.get_relation_params(class_name: singularized_class_name)
|
14
14
|
File.open(file_path, "w") do |f|
|
15
15
|
f.write(<<~TEXT)
|
16
16
|
module Types
|
@@ -21,9 +21,9 @@ module Souls
|
|
21
21
|
end
|
22
22
|
File.open(file_path, "a") do |f|
|
23
23
|
params[:params].each_with_index do |param, i|
|
24
|
-
type =
|
24
|
+
type = SOULs.type_check(param[:type])
|
25
25
|
type = "[#{type}]" if param[:array]
|
26
|
-
rbs_type =
|
26
|
+
rbs_type = SOULs.rbs_type_check(param[:type])
|
27
27
|
if i.zero?
|
28
28
|
if param[:column_name].match?(/$*_id\z/)
|
29
29
|
col_name = param[:column_name].gsub("_id", "")
|
@@ -49,7 +49,7 @@ module Souls
|
|
49
49
|
TEXT
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
SOULs::Painter.create_file(file_path.to_s)
|
53
53
|
file_path
|
54
54
|
end
|
55
55
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class Github < Thor
|
3
3
|
desc "secret_set", "Github Secret Set from .env.production"
|
4
4
|
def secret_set
|
5
|
-
Dir.chdir(
|
5
|
+
Dir.chdir(SOULs.get_mother_path.to_s) do
|
6
6
|
file_path = ".env.production"
|
7
7
|
File.open(file_path, "r") do |file|
|
8
8
|
file.each_line do |line|
|
@@ -33,7 +33,7 @@ module Souls
|
|
33
33
|
remote_url = `git remote get-url origin`
|
34
34
|
split_url = %r{(https://|git@)(github.com)(:|/)([^.]+/[^.]+)(\.git)?}.match(remote_url)
|
35
35
|
if split_url.nil? || split_url.size != 6
|
36
|
-
|
36
|
+
SOULs::Painter.error("Cannot access Github, please check your credentials")
|
37
37
|
return
|
38
38
|
end
|
39
39
|
|
@@ -41,7 +41,7 @@ module Souls
|
|
41
41
|
workflows = JSON.parse(`#{api_request}`)
|
42
42
|
|
43
43
|
if workflows.nil? || !workflows.key?("workflow_runs")
|
44
|
-
|
44
|
+
SOULs::Painter.error("Failed to parse JSON response from Github")
|
45
45
|
return
|
46
46
|
end
|
47
47
|
|
@@ -53,7 +53,7 @@ module Souls
|
|
53
53
|
wf_id =
|
54
54
|
case wf_info.size
|
55
55
|
when 0
|
56
|
-
|
56
|
+
SOULs::Painter.error("No workflow is running")
|
57
57
|
return
|
58
58
|
when 1
|
59
59
|
wf_info[0].values[0]
|
@@ -68,47 +68,47 @@ module Souls
|
|
68
68
|
private
|
69
69
|
|
70
70
|
def update_env_production(key:, value:, dqm: false)
|
71
|
-
Dir.chdir(
|
71
|
+
Dir.chdir(SOULs.get_mother_path.to_s) do
|
72
72
|
file_path = ".env.production"
|
73
73
|
File.open(file_path, "a") do |line|
|
74
74
|
dqm ? line.write("\n#{key.upcase}=\"#{value}\"") : line.write("\n#{key.upcase}=#{value}")
|
75
75
|
end
|
76
|
-
|
76
|
+
SOULs::Painter.update_file(file_path.to_s)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
def update_api_env(key:, value:, dqm: false)
|
81
|
-
Dir.chdir(
|
81
|
+
Dir.chdir(SOULs.get_api_path.to_s) do
|
82
82
|
file_path = ".env"
|
83
83
|
File.open(file_path, "a") do |line|
|
84
84
|
dqm ? line.write("\n#{key.upcase}=\"#{value}\"") : line.write("\n#{key.upcase}=#{value}")
|
85
85
|
end
|
86
|
-
|
86
|
+
SOULs::Painter.update_file(file_path.to_s)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
90
|
def update_workers_env(key:, value:, dqm: false)
|
91
|
-
Dir.chdir(
|
91
|
+
Dir.chdir(SOULs.get_mother_path.to_s) do
|
92
92
|
workers = Dir["apps/worker-*"]
|
93
93
|
workers.each do |worker_path|
|
94
94
|
file_path = "#{worker_path}/.env"
|
95
95
|
File.open(file_path, "a") do |line|
|
96
96
|
dqm ? line.write("\n#{key.upcase}=\"#{value}\"") : line.write("\n#{key.upcase}=#{value}")
|
97
97
|
end
|
98
|
-
|
98
|
+
SOULs::Painter.update_file(file_path.to_s)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
def update_github_actions(key:)
|
104
|
-
Dir.chdir(
|
104
|
+
Dir.chdir(SOULs.get_mother_path.to_s) do
|
105
105
|
file_paths = Dir[".github/workflows/*.yml"]
|
106
106
|
file_paths.each do |file_path|
|
107
107
|
worker_workflow = File.readlines(file_path)
|
108
108
|
worker_workflow[worker_workflow.size - 1] = worker_workflow.last.chomp
|
109
109
|
worker_workflow << " \\\n --set-env-vars=\"#{key.upcase}=${{ secrets.#{key.upcase} }}\""
|
110
110
|
File.open(file_path, "w") { |f| f.write(worker_workflow.join) }
|
111
|
-
|
111
|
+
SOULs::Painter.update_file(file_path.to_s)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
data/lib/souls/cli/index.rb
CHANGED
data/lib/souls/cli/init/index.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
module
|
1
|
+
module SOULs
|
2
2
|
class CLI < Thor
|
3
3
|
def initialize(*_args)
|
4
4
|
super
|
5
|
-
@bucket_url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{
|
5
|
+
@bucket_url = "https://storage.googleapis.com/souls-bucket/boilerplates/#{SOULs::VERSION}"
|
6
6
|
end
|
7
7
|
|
8
8
|
desc "new [APP_NAME]", "Create SOULs APP"
|
@@ -67,7 +67,7 @@ module Souls
|
|
67
67
|
file_path = "#{config_dir}/souls.rb"
|
68
68
|
File.open(file_path, "w") do |f|
|
69
69
|
f.write(<<~TEXT)
|
70
|
-
|
70
|
+
SOULs.configure do |config|
|
71
71
|
config.app = "#{app_name}"
|
72
72
|
config.project_id = "#{app_name}"
|
73
73
|
config.region = "asia-northeast1"
|
@@ -98,7 +98,7 @@ module Souls
|
|
98
98
|
file_path = "#{config_dir}/souls.rb"
|
99
99
|
File.open(file_path, "w") do |f|
|
100
100
|
f.write(<<~TEXT)
|
101
|
-
|
101
|
+
SOULs.configure do |config|
|
102
102
|
config.app = "#{app_name}"
|
103
103
|
config.project_id = "#{app_name}"
|
104
104
|
config.region = "asia-northeast1"
|
@@ -115,8 +115,8 @@ module Souls
|
|
115
115
|
|
116
116
|
def get_latest_gem(app_name)
|
117
117
|
file_path = "./#{app_name}/Gemfile"
|
118
|
-
souls_gem = "gem \"souls\", \"#{
|
119
|
-
souls_gem = "gem \"souls\", \"#{
|
118
|
+
souls_gem = "gem \"souls\", \"#{SOULs::VERSION}\""
|
119
|
+
souls_gem = "gem \"souls\", \"#{SOULs::VERSION}\", path: \"~/.local_souls/\"" if SOULs::VERSION.length > 20
|
120
120
|
File.open(file_path, "w") do |f|
|
121
121
|
f.write(<<~TEXT)
|
122
122
|
source "https://rubygems.org"
|
@@ -144,7 +144,7 @@ module Souls
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def download_souls(app_name: "souls", service_name: "api")
|
147
|
-
version =
|
147
|
+
version = SOULs.get_latest_version_txt(service_name: 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}")
|
@@ -189,7 +189,7 @@ module Souls
|
|
189
189
|
puts(line)
|
190
190
|
welcome = Paint["Welcome to SOULs!", :white]
|
191
191
|
puts(welcome)
|
192
|
-
souls_ver = Paint["SOULs Version: #{
|
192
|
+
souls_ver = Paint["SOULs Version: #{SOULs::VERSION}", :white]
|
193
193
|
puts(souls_ver)
|
194
194
|
puts(line)
|
195
195
|
endroll = <<~TEXT
|
@@ -1,24 +1,24 @@
|
|
1
1
|
require "securerandom"
|
2
2
|
|
3
|
-
module
|
3
|
+
module SOULs
|
4
4
|
class CLI < Thor
|
5
5
|
desc "release", "Release Gem"
|
6
6
|
def release
|
7
|
-
|
7
|
+
SOULs::Painter.error("hey! It's Broken!") unless system("rspec")
|
8
8
|
|
9
9
|
system("gem install souls")
|
10
10
|
sleep(3)
|
11
|
-
current_souls_ver =
|
11
|
+
current_souls_ver = SOULs::VERSION.strip.split(".").map(&:to_i)
|
12
12
|
prompt = TTY::Prompt.new
|
13
13
|
choices = [
|
14
|
-
"1. Patch(#{
|
15
|
-
"2. Minor(#{
|
16
|
-
"3. Major(#{
|
14
|
+
"1. Patch(#{SOULs.version_detector(current_ver: current_souls_ver, update_kind: 'patch')})",
|
15
|
+
"2. Minor(#{SOULs.version_detector(current_ver: current_souls_ver, update_kind: 'minor')})",
|
16
|
+
"3. Major(#{SOULs.version_detector(current_ver: current_souls_ver, update_kind: 'major')})"
|
17
17
|
]
|
18
18
|
choice_num = prompt.select("Select Version: ", choices)[0].to_i
|
19
19
|
update_kinds = %w[patch minor major]
|
20
20
|
update_kind = update_kinds[choice_num - 1]
|
21
|
-
souls_new_ver =
|
21
|
+
souls_new_ver = SOULs.version_detector(current_ver: current_souls_ver, update_kind: update_kind)
|
22
22
|
status = Paint["Saving Repo...", :yellow]
|
23
23
|
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
24
24
|
Whirly.status = status
|
@@ -160,7 +160,7 @@ module Souls
|
|
160
160
|
file_path = "./lib/souls/version.rb"
|
161
161
|
File.open(file_path, "w") do |f|
|
162
162
|
f.write(<<~TEXT)
|
163
|
-
module
|
163
|
+
module SOULs
|
164
164
|
VERSION = "#{new_version}".freeze
|
165
165
|
public_constant :VERSION
|
166
166
|
end
|