souls 2.0.4 → 3.0.0
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 -23
- data/lib/souls/cli/create/index.rb +0 -62
- data/lib/souls/cli/db/create_migration.rb +0 -1
- data/lib/souls/cli/db/index.rb +0 -2
- data/lib/souls/cli/delete/application.rb +2 -18
- data/lib/souls/cli/delete/job.rb +0 -1
- data/lib/souls/cli/delete/manager.rb +0 -1
- data/lib/souls/cli/delete/migration_file.rb +0 -1
- data/lib/souls/cli/generate/application.rb +2 -26
- data/lib/souls/cli/generate/job.rb +0 -1
- data/lib/souls/cli/generate/manager.rb +0 -1
- data/lib/souls/cli/generate/mutation.rb +2 -2
- data/lib/souls/cli/init/index.rb +0 -8
- data/lib/souls/cli/update/index.rb +0 -7
- data/lib/souls/cli/upgrade/index.rb +0 -1
- data/lib/souls/cli.rb +2 -20
- data/lib/souls/utils/index.rb +0 -13
- 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 +4 -25
- data/lib/souls/cli/db/create_migration_rbs.rb +0 -25
- data/lib/souls/cli/db/model_rbs.rb +0 -22
- data/lib/souls/cli/delete/connection_rbs.rb +0 -16
- data/lib/souls/cli/delete/edge_rbs.rb +0 -15
- data/lib/souls/cli/delete/job_rbs.rb +0 -22
- data/lib/souls/cli/delete/manager_rbs.rb +0 -17
- data/lib/souls/cli/delete/mutation_rbs.rb +0 -15
- data/lib/souls/cli/delete/query_rbs.rb +0 -16
- data/lib/souls/cli/delete/resolver_rbs.rb +0 -16
- data/lib/souls/cli/delete/type_rbs.rb +0 -16
- data/lib/souls/cli/generate/connection_rbs.rb +0 -25
- data/lib/souls/cli/generate/edge_rbs.rb +0 -28
- data/lib/souls/cli/generate/job_rbs.rb +0 -40
- data/lib/souls/cli/generate/manager_rbs.rb +0 -32
- data/lib/souls/cli/generate/mutation_rbs.rb +0 -241
- data/lib/souls/cli/generate/query_rbs.rb +0 -38
- data/lib/souls/cli/generate/resolver_rbs.rb +0 -42
- data/lib/souls/cli/generate/type_rbs.rb +0 -56
- data/lib/souls/cli/update/mutation_rbs.rb +0 -126
- data/lib/souls/cli/update/type_rbs.rb +0 -44
- data/lib/souls/cli/upgrade/submodule.rb +0 -8
@@ -1,126 +0,0 @@
|
|
1
|
-
module SOULs
|
2
|
-
class Update < Thor
|
3
|
-
desc "create_mutation_rbs [CLASS_NAME]", "Update GraphQL Type from schema.rb"
|
4
|
-
def create_mutation_rbs(class_name)
|
5
|
-
singularized_class_name = class_name.singularize.underscore
|
6
|
-
new_cols = ""
|
7
|
-
Dir.chdir(SOULs.get_api_path.to_s) do
|
8
|
-
new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
|
9
|
-
end
|
10
|
-
dir_name = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
|
11
|
-
file_path = "#{dir_name}/create_#{singularized_class_name}.rbs"
|
12
|
-
argument = false
|
13
|
-
resolve = false
|
14
|
-
write_txt = ""
|
15
|
-
File.open(file_path, "r") do |f|
|
16
|
-
f.each_line do |line|
|
17
|
-
next if line.include?("| (:") && argument
|
18
|
-
|
19
|
-
if line.include?("{ :node => String } } | ::GraphQL::ExecutionError )")
|
20
|
-
write_txt += line
|
21
|
-
resolve = false
|
22
|
-
elsif resolve
|
23
|
-
next
|
24
|
-
elsif line.include?("def resolve:") && !resolve
|
25
|
-
new_cols.each_with_index do |col, i|
|
26
|
-
type = SOULs.type_check(col[:type])
|
27
|
-
type = "[#{type}]" if col[:array]
|
28
|
-
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
29
|
-
|
30
|
-
write_txt +=
|
31
|
-
if i.zero?
|
32
|
-
line
|
33
|
-
else
|
34
|
-
" #{col[:column_name]}: #{type}?,\n"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
resolve = true
|
38
|
-
elsif line.include?("def self.argument:") && !argument
|
39
|
-
new_cols.each_with_index do |col, i|
|
40
|
-
type = SOULs.type_check(col[:type])
|
41
|
-
type = "[#{type}]" if col[:array]
|
42
|
-
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
43
|
-
|
44
|
-
if i.zero?
|
45
|
-
write_txt +=
|
46
|
-
" def self.argument: (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
47
|
-
else
|
48
|
-
write_txt +=
|
49
|
-
" | (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
argument = true
|
53
|
-
else
|
54
|
-
write_txt += line
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
File.open(file_path, "w") { |f| f.write(write_txt) }
|
59
|
-
SOULs::Painter.update_file(file_path.to_s)
|
60
|
-
end
|
61
|
-
|
62
|
-
desc "update_mutation [CLASS_NAME]", "Update GraphQL Type from schema.rb"
|
63
|
-
def update_mutation_rbs(class_name)
|
64
|
-
singularized_class_name = class_name.singularize.underscore
|
65
|
-
new_cols = ""
|
66
|
-
Dir.chdir(SOULs.get_api_path.to_s) do
|
67
|
-
new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
|
68
|
-
end
|
69
|
-
dir_name = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
|
70
|
-
new_file_path = "config/update_mutation.rbs"
|
71
|
-
file_path = "#{dir_name}/update_#{singularized_class_name}.rbs"
|
72
|
-
argument = false
|
73
|
-
resolve = false
|
74
|
-
File.open(file_path) do |f|
|
75
|
-
File.open(new_file_path, "w") do |new_line|
|
76
|
-
f.each_line do |line|
|
77
|
-
next if line.include?("| (:") && argument
|
78
|
-
|
79
|
-
if line.include?("{ :node => String } } | ::GraphQL::ExecutionError )")
|
80
|
-
new_line.write(line)
|
81
|
-
resolve = false
|
82
|
-
elsif resolve
|
83
|
-
next
|
84
|
-
elsif line.include?("def resolve:") && !resolve
|
85
|
-
new_cols.each_with_index do |col, i|
|
86
|
-
type = SOULs.type_check(col[:type])
|
87
|
-
type = "[#{type}]" if col[:array]
|
88
|
-
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
89
|
-
|
90
|
-
if i.zero?
|
91
|
-
new_line.write(line)
|
92
|
-
new_line.write(" id: String,\n")
|
93
|
-
else
|
94
|
-
new_line.write(" #{col[:column_name]}: #{type}?,\n")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
resolve = true
|
98
|
-
elsif line.include?("def self.argument:") && !argument
|
99
|
-
new_cols.each_with_index do |col, i|
|
100
|
-
type = SOULs.type_check(col[:type])
|
101
|
-
type = "[#{type}]" if col[:array]
|
102
|
-
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
103
|
-
|
104
|
-
if i.zero?
|
105
|
-
new_line.write(
|
106
|
-
" def self.argument: (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
107
|
-
)
|
108
|
-
else
|
109
|
-
new_line.write(
|
110
|
-
" | (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
111
|
-
)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
argument = true
|
115
|
-
else
|
116
|
-
new_line.write(line)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
FileUtils.rm(file_path)
|
122
|
-
FileUtils.mv(new_file_path, file_path)
|
123
|
-
SOULs::Painter.update_file(file_path.to_s)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module SOULs
|
2
|
-
class Update < Thor
|
3
|
-
desc "type_rbs [CLASS_NAME]", "Update GraphQL Type from schema.rb"
|
4
|
-
def type_rbs(class_name)
|
5
|
-
singularized_class_name = class_name.singularize.underscore
|
6
|
-
new_cols = ""
|
7
|
-
Dir.chdir(SOULs.get_api_path.to_s) do
|
8
|
-
new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
|
9
|
-
end
|
10
|
-
dir_name = "./sig/api/app/graphql/types"
|
11
|
-
new_file_path = "config/create_type.rbs"
|
12
|
-
file_path = "#{dir_name}/#{singularized_class_name}_type.rbs"
|
13
|
-
argument = false
|
14
|
-
File.open(file_path) do |f|
|
15
|
-
File.open(new_file_path, "w") do |new_line|
|
16
|
-
f.each_line do |line|
|
17
|
-
next if line.include?("| (:") && argument
|
18
|
-
|
19
|
-
if line.include?(" def self.edge_type:")
|
20
|
-
new_line.write(line)
|
21
|
-
argument = false
|
22
|
-
elsif line.include?("def self.field:") && !argument
|
23
|
-
new_cols.each_with_index do |col, i|
|
24
|
-
type = SOULs.get_type(col[:type])
|
25
|
-
type = "[#{type}]" if col[:array]
|
26
|
-
if i.zero?
|
27
|
-
new_line.write(" def self.field: (:#{col[:column_name]}, #{type}, null: true) -> #{type}\n")
|
28
|
-
else
|
29
|
-
new_line.write(" | (:#{col[:column_name]}, #{type}, null: true) -> #{type}\n")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
argument = true
|
33
|
-
else
|
34
|
-
new_line.write(line)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
FileUtils.rm(file_path)
|
40
|
-
FileUtils.mv(new_file_path, file_path)
|
41
|
-
SOULs::Painter.update_file(file_path.to_s)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|