souls 0.70.6 → 0.71.1
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.
- checksums.yaml +4 -4
- data/lib/souls/cli/gcloud/sql/index.rb +4 -2
- data/lib/souls/cli/generate/type_rbs.rb +2 -2
- data/lib/souls/cli/update/index.rb +13 -8
- 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: ad9d5643107678ff3aab040a1bf6e6c2313bd8fb686f78ad2b39c84d983e7c83
|
4
|
+
data.tar.gz: 9bcf98ab7ff78452c104c5d4d0330616fa11c46d2072abec0dba2d356f48bed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c656466cd3a7c86e547a368557c0a3c71ebeed67bdf0f7d6388a03d6a573dc8b0c352434b7b3805e8364b8602155c50f9c5b4bfef6ad74dce2c1c6125412ae
|
7
|
+
data.tar.gz: 22c4f6010d42209507111495125a25f823eef45a0b33dc488bdbe74aef5cf0814b0c78d9a0d19a9dc6ba4afbfb1b9f645d28551dfaceb0973ae58f17508e278f
|
@@ -45,6 +45,7 @@ module Souls
|
|
45
45
|
desc "create_ip_range", "Create VPC Adress Range"
|
46
46
|
def create_ip_range
|
47
47
|
app_name = Souls.configuration.app
|
48
|
+
project_id = Souls.configuration.project_id
|
48
49
|
system(
|
49
50
|
"
|
50
51
|
gcloud compute addresses create #{app_name}-ip-range \
|
@@ -53,7 +54,7 @@ module Souls
|
|
53
54
|
--prefix-length=16 \
|
54
55
|
--description='peering range for SOULs' \
|
55
56
|
--network=#{app_name} \
|
56
|
-
--project=#{
|
57
|
+
--project=#{project_id}"
|
57
58
|
)
|
58
59
|
rescue Thor::Error => e
|
59
60
|
raise(Thor::Error, e)
|
@@ -62,13 +63,14 @@ module Souls
|
|
62
63
|
desc "create_vpc_connector", "Create VPC-PEERING Connect"
|
63
64
|
def create_vpc_connector
|
64
65
|
app_name = Souls.configuration.app
|
66
|
+
project_id = Souls.configuration.project_id
|
65
67
|
system(
|
66
68
|
"
|
67
69
|
gcloud services vpc-peerings connect \
|
68
70
|
--service=servicenetworking.googleapis.com \
|
69
71
|
--ranges=#{app_name}-ip-range \
|
70
72
|
--network=#{app_name} \
|
71
|
-
--project=#{
|
73
|
+
--project=#{project_id}
|
72
74
|
"
|
73
75
|
)
|
74
76
|
rescue Thor::Error => e
|
@@ -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"
|
@@ -8,14 +10,17 @@ require_relative "./rspec_resolver"
|
|
8
10
|
module Souls
|
9
11
|
class Update < Thor
|
10
12
|
desc "scaffold [CLASS_NAME]", "Update Scaffold Params"
|
11
|
-
def scaffold(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
def scaffold(class_name)
|
14
|
+
create_mutation(class_name)
|
15
|
+
update_mutation(class_name)
|
16
|
+
create_mutation_rbs(class_name)
|
17
|
+
update_mutation_rbs(class_name)
|
18
|
+
resolver(class_name)
|
19
|
+
type(class_name)
|
20
|
+
type_rbs(class_name)
|
21
|
+
rspec_factory(class_name)
|
22
|
+
rspec_mutation(class_name)
|
23
|
+
rspec_resolver(class_name)
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
@@ -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.1
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.50.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: 0.
|
4
|
+
version: 0.71.1
|
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
|