souls 0.70.8 → 0.71.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/souls/cli/generate/type_rbs.rb +2 -2
- data/lib/souls/cli/update/index.rb +5 -0
- data/lib/souls/cli/update/mutation_rbs.rb +91 -26
- data/lib/souls/cli/update/type_rbs.rb +43 -0
- 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 +2 -2
- data/lib/souls/cli/update/resolver_rbs.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b722e511cf4e7f9ca061776be361d4d30a3020fbf08d7df2b31c711960681484
|
4
|
+
data.tar.gz: f5d0d91fad2bfebb573cf996265431fd9fd5f557a2b75e3ccd90e4c93ef46d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11dc02dcbac8a8cf91e5dbef64cae38c9b3c60faf42618495b5b26b1f17f595435821cecd048e9aed6d2691652bedafb69ea4de7ba1f645446497791f2e6a2d1
|
7
|
+
data.tar.gz: 2732140c8becba6b20f10dcde04ed23d32f9085ea75f6487cd54d91a063ef83086e1bc2cd10bd355bb1750026c6241d032f44580b71cb1a56bc2023ce71fb900
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require_relative "./mutation"
|
2
|
+
require_relative "./mutation_rbs"
|
2
3
|
require_relative "./resolver"
|
3
4
|
require_relative "./type"
|
5
|
+
require_relative "./type_rbs"
|
4
6
|
require_relative "./rspec_factory"
|
5
7
|
require_relative "./rspec_mutation"
|
6
8
|
require_relative "./rspec_resolver"
|
@@ -11,8 +13,11 @@ module Souls
|
|
11
13
|
def scaffold(_class_name)
|
12
14
|
invoke(:create_mutation)
|
13
15
|
invoke(:update_mutation)
|
16
|
+
invoke(:create_mutation_rbs)
|
17
|
+
invoke(:update_mutation_rbs)
|
14
18
|
invoke(:resolver)
|
15
19
|
invoke(:type)
|
20
|
+
invoke(:type_rbs)
|
16
21
|
invoke(:rspec_factory)
|
17
22
|
invoke(:rspec_mutation)
|
18
23
|
invoke(:rspec_resolver)
|
@@ -8,22 +8,54 @@ module Souls
|
|
8
8
|
new_file_path = "tmp/create_mutation.rbs"
|
9
9
|
file_path = "#{dir_name}/create_#{singularized_class_name}.rbs"
|
10
10
|
argument = false
|
11
|
+
resolve = false
|
11
12
|
File.open(file_path) do |f|
|
12
13
|
File.open(new_file_path, "w") do |new_line|
|
13
14
|
f.each_line do |line|
|
14
|
-
|
15
|
-
next unless line.include?("argument") && !argument
|
15
|
+
next if line.include?("| (:") && argument
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
next
|
22
|
-
|
17
|
+
if line.include?("{ :node => String } } | ::GraphQL::ExecutionError )")
|
18
|
+
new_line.write(line)
|
19
|
+
resolve = false
|
20
|
+
elsif resolve
|
21
|
+
next
|
22
|
+
elsif line.include?("def resolve:") && !resolve
|
23
|
+
new_cols.each_with_index do |col, i|
|
24
|
+
type = Souls.type_check(col[:type])
|
25
|
+
type = "[#{type}]" if col[:array]
|
26
|
+
args = check_mutation_argument(class_name: class_name)
|
27
|
+
next if args.include?(col[:column_name])
|
28
|
+
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
23
29
|
|
24
|
-
|
30
|
+
if i.zero?
|
31
|
+
new_line.write(line)
|
32
|
+
else
|
33
|
+
new_line.write(" #{col[:column_name]}: #{type}?,\n")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
resolve = true
|
37
|
+
elsif line.include?("def self.argument:") && !argument
|
38
|
+
new_cols.each_with_index do |col, i|
|
39
|
+
type = Souls.type_check(col[:type])
|
40
|
+
type = "[#{type}]" if col[:array]
|
41
|
+
args = check_mutation_argument(class_name: class_name)
|
42
|
+
next if args.include?(col[:column_name])
|
43
|
+
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
44
|
+
|
45
|
+
if i.zero?
|
46
|
+
new_line.write(
|
47
|
+
" def self.argument: (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
48
|
+
)
|
49
|
+
else
|
50
|
+
new_line.write(
|
51
|
+
" | (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
argument = true
|
56
|
+
else
|
57
|
+
new_line.write(line)
|
25
58
|
end
|
26
|
-
argument = true
|
27
59
|
end
|
28
60
|
end
|
29
61
|
end
|
@@ -35,29 +67,62 @@ module Souls
|
|
35
67
|
end
|
36
68
|
|
37
69
|
desc "update_mutation [CLASS_NAME]", "Update GraphQL Type from schema.rb"
|
38
|
-
def
|
70
|
+
def update_mutation_rbs(class_name)
|
39
71
|
singularized_class_name = class_name.singularize.underscore
|
40
72
|
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
41
|
-
dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
|
42
|
-
new_file_path = "tmp/update_mutation.
|
43
|
-
file_path = "#{dir_name}/update_#{singularized_class_name}.
|
73
|
+
dir_name = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
|
74
|
+
new_file_path = "tmp/update_mutation.rbs"
|
75
|
+
file_path = "#{dir_name}/update_#{singularized_class_name}.rbs"
|
44
76
|
argument = false
|
77
|
+
resolve = false
|
45
78
|
File.open(file_path) do |f|
|
46
79
|
File.open(new_file_path, "w") do |new_line|
|
47
80
|
f.each_line do |line|
|
48
|
-
|
49
|
-
next unless line.include?("argument") && !argument
|
81
|
+
next if line.include?("| (:") && argument
|
50
82
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
next
|
56
|
-
|
83
|
+
if line.include?("{ :node => String } } | ::GraphQL::ExecutionError )")
|
84
|
+
new_line.write(line)
|
85
|
+
resolve = false
|
86
|
+
elsif resolve
|
87
|
+
next
|
88
|
+
elsif line.include?("def resolve:") && !resolve
|
89
|
+
new_cols.each_with_index do |col, i|
|
90
|
+
type = Souls.type_check(col[:type])
|
91
|
+
type = "[#{type}]" if col[:array]
|
92
|
+
args = check_mutation_argument(class_name: class_name)
|
93
|
+
next if args.include?(col[:column_name])
|
94
|
+
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
57
95
|
|
58
|
-
|
96
|
+
if i.zero?
|
97
|
+
new_line.write(line)
|
98
|
+
new_line.write(" id: String,\n")
|
99
|
+
else
|
100
|
+
new_line.write(" #{col[:column_name]}: #{type}?,\n")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
resolve = true
|
104
|
+
elsif line.include?("def self.argument:") && !argument
|
105
|
+
new_cols.each_with_index do |col, i|
|
106
|
+
type = Souls.type_check(col[:type])
|
107
|
+
type = "[#{type}]" if col[:array]
|
108
|
+
args = check_mutation_argument(class_name: class_name)
|
109
|
+
next if args.include?(col[:column_name])
|
110
|
+
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
111
|
+
|
112
|
+
if i.zero?
|
113
|
+
new_line.write(
|
114
|
+
" def self.argument: (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
115
|
+
)
|
116
|
+
else
|
117
|
+
new_line.write(
|
118
|
+
" | (:#{col[:column_name]}, #{type}, required: false ) -> #{type}\n"
|
119
|
+
)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
argument = true
|
123
|
+
else
|
124
|
+
new_line.write(line)
|
59
125
|
end
|
60
|
-
argument = true
|
61
126
|
end
|
62
127
|
end
|
63
128
|
end
|
@@ -72,8 +137,8 @@ module Souls
|
|
72
137
|
|
73
138
|
def check_mutation_argument(class_name: "user", action: "create")
|
74
139
|
singularized_class_name = class_name.singularize.underscore
|
75
|
-
dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
|
76
|
-
file_path = "#{dir_name}/#{action}_#{singularized_class_name}.
|
140
|
+
dir_name = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
|
141
|
+
file_path = "#{dir_name}/#{action}_#{singularized_class_name}.rbs"
|
77
142
|
args = []
|
78
143
|
File.open(file_path) do |f|
|
79
144
|
f.each_line do |line|
|
@@ -0,0 +1,43 @@
|
|
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 = Souls.get_columns_num(class_name: singularized_class_name)
|
7
|
+
dir_name = "./sig/api/app/graphql/types"
|
8
|
+
new_file_path = "tmp/create_type.rbs"
|
9
|
+
file_path = "#{dir_name}/#{singularized_class_name}_type.rbs"
|
10
|
+
argument = false
|
11
|
+
File.open(file_path) do |f|
|
12
|
+
File.open(new_file_path, "w") do |new_line|
|
13
|
+
f.each_line do |line|
|
14
|
+
next if line.include?("| (:") && argument
|
15
|
+
|
16
|
+
if line.include?(" def self.edge_type:")
|
17
|
+
new_line.write(line)
|
18
|
+
argument = false
|
19
|
+
elsif line.include?("def self.argument:") && !argument
|
20
|
+
new_cols.each_with_index do |col, i|
|
21
|
+
type = Souls.get_type(col[:type])
|
22
|
+
type = "[#{type}]" if col[:array]
|
23
|
+
if i.zero?
|
24
|
+
new_line.write(" def self.field: (:#{col[:column_name]}, #{type}, null: true) -> #{type}\n")
|
25
|
+
else
|
26
|
+
new_line.write(" | (:#{col[:column_name]}, #{type}, null: true) -> #{type}\n")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
argument = true
|
30
|
+
else
|
31
|
+
new_line.write(line)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
FileUtils.rm(file_path)
|
37
|
+
FileUtils.mv(new_file_path, file_path)
|
38
|
+
puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
39
|
+
rescue Thor::Error => e
|
40
|
+
raise(Thor::Error, e)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.50.0
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.50.0
|
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: 0.
|
4
|
+
version: 0.71.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -210,11 +210,11 @@ files:
|
|
210
210
|
- lib/souls/cli/update/mutation.rb
|
211
211
|
- lib/souls/cli/update/mutation_rbs.rb
|
212
212
|
- lib/souls/cli/update/resolver.rb
|
213
|
-
- lib/souls/cli/update/resolver_rbs.rb
|
214
213
|
- lib/souls/cli/update/rspec_factory.rb
|
215
214
|
- lib/souls/cli/update/rspec_mutation.rb
|
216
215
|
- lib/souls/cli/update/rspec_resolver.rb
|
217
216
|
- lib/souls/cli/update/type.rb
|
217
|
+
- lib/souls/cli/update/type_rbs.rb
|
218
218
|
- lib/souls/cli/upgrade/gemfile.rb
|
219
219
|
- lib/souls/cli/upgrade/index.rb
|
220
220
|
- lib/souls/cli/upgrade/submodule.rb
|
File without changes
|