souls 0.15.4 → 0.15.9
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/Gemfile.lock +1 -1
- data/README.md +68 -26
- data/exe/souls +8 -4
- data/lib/souls/generate.rb +202 -15
- data/lib/souls/init.rb +69 -22
- data/lib/souls/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97b633e63386e23600b2dc136dd7575cc3180fd7751446dd2b016a1ef1b9899e
|
4
|
+
data.tar.gz: d24460e3dfaa6ad58a12dca3d5a1afe7719edabc0f8b7867470c8e00849ef685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc6500a3f791ff01b266e557ddcabcb6c2129c18688396817369822d716d71eb2bbb4edc0274574280875d18e2f417dd037707194587ac2e34ec771e12aabea6
|
7
|
+
data.tar.gz: ae8b9925a0d9075ab7524c295863fa51b88f3b3a801b0db2a95f5d5e1e1557670b99d55d0e69615c93cc71162733844c0b2a19b5adfae178e5f9666293c504f4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,14 +21,18 @@
|
|
21
21
|
|
22
22
|
Welcome to SOULs Framework!
|
23
23
|
|
24
|
-
SOULS is a Web Application Framework
|
24
|
+
SOULS is a Web Application Framework based on GraphQL Relay ( Ruby )
|
25
|
+
This is Cloud Based APP Framework. Easy Deployment.
|
26
|
+
Microservices on Multi Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud. Auto deploy with scalable condition.
|
27
|
+
You can focus on business logic. No more infra problems.
|
25
28
|
|
26
|
-
SOULs creates
|
29
|
+
SOULs creates 5 types of framework.
|
27
30
|
|
28
|
-
1.
|
29
|
-
2. API - GraphQL to call gRPC (Ruby)
|
30
|
-
3.
|
31
|
-
4.
|
31
|
+
1. API - GraphQL (Ruby) - Simple API
|
32
|
+
2. API - GraphQL to call gRPC (Ruby) - for heavy task processes
|
33
|
+
3. Service - gRPC Serverless Scalable Service (Ruby)
|
34
|
+
4. Media Web Client - Media web client with SSG (TypeScript)
|
35
|
+
5. Admin Web Client - Admin Console and CMS (TypeScript)
|
32
36
|
|
33
37
|
## Dependency
|
34
38
|
|
@@ -66,42 +70,80 @@ And Create Your APP
|
|
66
70
|
|
67
71
|
### Choose SOULs Type:
|
68
72
|
|
69
|
-
1.
|
70
|
-
2. API
|
71
|
-
3.
|
72
|
-
4.
|
73
|
+
1. API
|
74
|
+
2. API - gRPC
|
75
|
+
3. Service
|
76
|
+
4. Media Web
|
77
|
+
5. Admin Web
|
73
78
|
|
74
|
-
## Usage
|
79
|
+
## Usage - 1. GraphQL API
|
75
80
|
|
76
|
-
|
81
|
+
```bash
|
82
|
+
# Ruby version (using rbenv)
|
83
|
+
$ ruby -v
|
84
|
+
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
|
77
85
|
|
78
|
-
|
86
|
+
# Install xcode
|
87
|
+
$ xcode-select --install
|
79
88
|
|
80
|
-
|
89
|
+
# Install PostgreSQL (Mac env)
|
90
|
+
$ brew install postgresql
|
81
91
|
|
82
|
-
|
92
|
+
# Install redis
|
93
|
+
$ brew install redis
|
83
94
|
|
84
|
-
|
95
|
+
# Version Check
|
96
|
+
$ souls -v
|
85
97
|
|
86
|
-
|
98
|
+
# Init SOULs App
|
99
|
+
$ souls new app_name
|
100
|
+
$ cd app_name
|
101
|
+
$ bundle
|
87
102
|
|
88
|
-
Run
|
103
|
+
# Run Dev & Test DB
|
104
|
+
$ souls i run_psql
|
89
105
|
|
90
|
-
|
106
|
+
# Create DB
|
107
|
+
$ souls db:create
|
91
108
|
|
92
|
-
|
109
|
+
# Migrate DB
|
110
|
+
$ souls db:migrate
|
93
111
|
|
94
|
-
|
112
|
+
# Create Test DB
|
113
|
+
$ souls db:seed
|
95
114
|
|
96
|
-
|
115
|
+
# Development (localhost:3000/playground)
|
116
|
+
$ souls s
|
97
117
|
|
98
|
-
|
118
|
+
# Development with Worker (localhost:3000/playground; localhost:3000/sidekiq)
|
119
|
+
$ foreman start -f Procfile.dev
|
99
120
|
|
100
|
-
|
121
|
+
# Test
|
122
|
+
$ bundle exec rspec
|
123
|
+
|
124
|
+
# Deploy (Edit: ./cloudbuild.yml)
|
125
|
+
$ souls deploy
|
126
|
+
|
127
|
+
# Run Infra Command
|
128
|
+
$ souls i `method_name`
|
129
|
+
```
|
130
|
+
|
131
|
+
## SOULs Scaffold
|
132
|
+
SOULs Scaffold creates CRUD API from `./db/schema.rb`
|
133
|
+
|
134
|
+
```bash
|
135
|
+
# Create migration file
|
136
|
+
$ souls g migration user
|
137
|
+
|
138
|
+
# Edit migration file
|
139
|
+
# Migrate DB
|
140
|
+
$ souls db:migrate
|
141
|
+
|
142
|
+
# SOULs Scaffold
|
143
|
+
$ souls g migrate user
|
144
|
+
```
|
101
145
|
|
102
|
-
Update
|
103
146
|
|
104
|
-
$ souls i update
|
105
147
|
|
106
148
|
## Development
|
107
149
|
|
data/exe/souls
CHANGED
@@ -13,9 +13,9 @@ begin
|
|
13
13
|
puts "you need to specify your app name \n `souls new app_name`"
|
14
14
|
exit
|
15
15
|
end
|
16
|
-
puts "Which framework: \n 1.
|
16
|
+
puts "Which framework: \n 1. SOULs GraphQL API \n 2. SOULs GraphQL API gRPC compatible \n 3. SOULs gRPC Service \n 4. SOULs Media Web \n 5. SOULs Admin Web \n Enter Number: "
|
17
17
|
strain = STDIN.gets.chomp.to_i
|
18
|
-
(1..5).include?(strain) ? puts("Generating
|
18
|
+
(1..5).include?(strain) ? puts("Generating SOULs.. \n") : raise(StandardError, "Choose Number 1..5")
|
19
19
|
Souls::Init.create_souls strain: strain, app_name: ARGV[1]
|
20
20
|
when "s", "server"
|
21
21
|
strain = Souls.configuration.strain
|
@@ -25,7 +25,7 @@ begin
|
|
25
25
|
when "service"
|
26
26
|
system "bundle exec rake run_server"
|
27
27
|
else
|
28
|
-
|
28
|
+
`bundle exec puma -p 3000 -e development`
|
29
29
|
end
|
30
30
|
when "c", "console"
|
31
31
|
strain = Souls.configuration.strain
|
@@ -33,7 +33,7 @@ begin
|
|
33
33
|
when "media", "admin"
|
34
34
|
system "yarn dev"
|
35
35
|
else
|
36
|
-
|
36
|
+
`bundle exec irb`
|
37
37
|
end
|
38
38
|
when "i", "infra"
|
39
39
|
Souls.send ARGV[1]
|
@@ -77,6 +77,8 @@ begin
|
|
77
77
|
Souls::Init.rspec_query class_name: ARGV[2]
|
78
78
|
when "rspec_type"
|
79
79
|
Souls::Init.rspec_type class_name: ARGV[2]
|
80
|
+
when "rspec_resolver"
|
81
|
+
Souls::Init.rspec_resolver class_name: ARGV[2]
|
80
82
|
else
|
81
83
|
"SOULs!"
|
82
84
|
end
|
@@ -84,6 +86,8 @@ begin
|
|
84
86
|
STDOUT.write `rake db:create && rake db:create RACK_ENV=test`
|
85
87
|
when "db:migrate"
|
86
88
|
STDOUT.write `rake db:migrate && rake db:migrate RACK_ENV=test`
|
89
|
+
when "db:seed"
|
90
|
+
STDOUT.write `rake db:seed`
|
87
91
|
when "db:migrate:reset"
|
88
92
|
STDOUT.write `rake db:migrate:reset && rake db:migrate:reset RACK_ENV=test`
|
89
93
|
when "t", "test"
|
data/lib/souls/generate.rb
CHANGED
@@ -18,6 +18,7 @@ module Souls
|
|
18
18
|
def resolver class_name: "souls"
|
19
19
|
FileUtils.mkdir_p "./app/graphql/resolvers" unless Dir.exist? "./app/graphql/resolvers"
|
20
20
|
file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
|
21
|
+
return ["Resolver already exist! #{file_path}"] if File.exist? file_path
|
21
22
|
File.open(file_path, "w") do |f|
|
22
23
|
f.write <<~EOS
|
23
24
|
module Resolvers
|
@@ -30,6 +31,7 @@ module Souls
|
|
30
31
|
class #{class_name.camelize}Filter < ::Types::BaseInputObject
|
31
32
|
argument :OR, [self], required: false
|
32
33
|
|
34
|
+
argument :is_deleted, Boolean, required: false
|
33
35
|
argument :start_date, String, required: false
|
34
36
|
argument :end_date, String, required: false
|
35
37
|
end
|
@@ -57,8 +59,9 @@ module Souls
|
|
57
59
|
end
|
58
60
|
|
59
61
|
def normalize_filters(value, branches = [])
|
60
|
-
scope =
|
62
|
+
scope = ::#{class_name.camelize}.all
|
61
63
|
|
64
|
+
scope = scope.where(is_deleted: value[:is_deleted]) if value[:is_deleted]
|
62
65
|
scope = scope.where("created_at >= ?", value[:start_date]) if value[:start_date]
|
63
66
|
scope = scope.where("created_at <= ?", value[:end_date]) if value[:end_date]
|
64
67
|
|
@@ -75,24 +78,208 @@ module Souls
|
|
75
78
|
[file_path]
|
76
79
|
end
|
77
80
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
def job class_name: "send_mail"
|
82
|
+
file_path = "./app/jobs/#{class_name.singularize}_job.rb"
|
83
|
+
return ["Job already exist! #{file_path}"] if File.exist? file_path
|
84
|
+
File.open(file_path, "w") do |f|
|
85
|
+
f.write <<~EOS
|
86
|
+
class #{class_name.camelize}
|
87
|
+
include Sidekiq::Status::Worker
|
88
|
+
include Sidekiq::Worker
|
89
|
+
sidekiq_options queue: "default"
|
90
|
+
|
91
|
+
def perform **args
|
92
|
+
# write task code here
|
93
|
+
end
|
94
|
+
end
|
95
|
+
EOS
|
96
|
+
end
|
97
|
+
[file_path]
|
98
|
+
end
|
99
|
+
|
100
|
+
def rspec_resolver_head class_name: "souls"
|
101
|
+
file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
|
102
|
+
puts file_path
|
103
|
+
File.open(file_path, "w") do |f|
|
104
|
+
f.write <<~EOS
|
105
|
+
RSpec.describe \"#{class_name.camelize}Search Resolver テスト\" do
|
106
|
+
describe "削除フラグ false の #{class_name.camelize} を返却する" do
|
107
|
+
EOS
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def rspec_resolver_after_head class_name: "souls"
|
112
|
+
file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
|
113
|
+
path = "./db/schema.rb"
|
114
|
+
@on = false
|
115
|
+
@user_exist = false
|
116
|
+
@relation_params = []
|
117
|
+
File.open(file_path, "a") do |new_line|
|
118
|
+
File.open(path, "r") do |f|
|
119
|
+
f.each_line.with_index do |line, i|
|
120
|
+
if @on
|
121
|
+
if line.include?("end") || line.include?("t.index")
|
122
|
+
if @relation_params.empty?
|
123
|
+
new_line.write <<-EOS
|
124
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
125
|
+
|
126
|
+
let(:query) do
|
127
|
+
%(query {
|
128
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
129
|
+
isDeleted: false
|
130
|
+
}) {
|
131
|
+
edges {
|
132
|
+
cursor
|
133
|
+
node {
|
134
|
+
id
|
135
|
+
EOS
|
136
|
+
else
|
137
|
+
new_line.write <<-EOS
|
138
|
+
let(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(", ")}) }
|
139
|
+
|
140
|
+
let(:query) do
|
141
|
+
%(query {
|
142
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
143
|
+
isDeleted: false
|
144
|
+
}) {
|
145
|
+
edges {
|
146
|
+
cursor
|
147
|
+
node {
|
148
|
+
id
|
149
|
+
EOS
|
150
|
+
end
|
151
|
+
break
|
152
|
+
end
|
153
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
154
|
+
case name
|
155
|
+
when /$*_id\z/
|
156
|
+
relation_col = name.gsub("_id", "")
|
157
|
+
@relation_params << "#{name}: #{relation_col}.id"
|
158
|
+
new_line.write " let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n"
|
159
|
+
end
|
160
|
+
end
|
161
|
+
if table_check(line: line, class_name: class_name)
|
162
|
+
@on = true
|
163
|
+
end
|
89
164
|
end
|
90
165
|
end
|
91
|
-
|
166
|
+
end
|
92
167
|
end
|
93
|
-
|
168
|
+
|
169
|
+
def rspec_resolver_params class_name: "souls"
|
170
|
+
file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
|
171
|
+
path = "./db/schema.rb"
|
172
|
+
@on = false
|
173
|
+
File.open(file_path, "a") do |new_line|
|
174
|
+
File.open(path, "r") do |f|
|
175
|
+
f.each_line.with_index do |line, i|
|
176
|
+
if @on
|
177
|
+
if line.include?("end") || line.include?("t.index")
|
178
|
+
new_line.write <<-EOS
|
179
|
+
}
|
180
|
+
}
|
181
|
+
nodes {
|
182
|
+
id
|
183
|
+
}
|
184
|
+
pageInfo {
|
185
|
+
endCursor
|
186
|
+
hasNextPage
|
187
|
+
startCursor
|
188
|
+
hasPreviousPage
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}
|
192
|
+
)
|
94
193
|
end
|
95
194
|
|
195
|
+
subject(:result) do
|
196
|
+
SoulsApiSchema.execute(query).as_json
|
197
|
+
end
|
198
|
+
|
199
|
+
it "return #{class_name.camelize} Data" do
|
200
|
+
begin
|
201
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
|
202
|
+
raise unless a1.present?
|
203
|
+
rescue
|
204
|
+
raise StandardError, result
|
205
|
+
end
|
206
|
+
expect(a1).to include(
|
207
|
+
"id" => be_a(String),
|
208
|
+
EOS
|
209
|
+
break
|
210
|
+
end
|
211
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
212
|
+
case name
|
213
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
214
|
+
next
|
215
|
+
else
|
216
|
+
new_line.write " #{name.camelize(:lower)}\n"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
if table_check(line: line, class_name: class_name)
|
220
|
+
@on = true
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def rspec_resolver_end class_name: "souls"
|
228
|
+
file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
|
229
|
+
path = "./db/schema.rb"
|
230
|
+
@on = false
|
231
|
+
File.open(file_path, "a") do |new_line|
|
232
|
+
File.open(path, "r") do |f|
|
233
|
+
f.each_line.with_index do |line, i|
|
234
|
+
if @on
|
235
|
+
if line.include?("end") || line.include?("t.index")
|
236
|
+
new_line.write <<-EOS
|
237
|
+
)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
EOS
|
242
|
+
break
|
243
|
+
end
|
244
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
245
|
+
field ||= type_check type
|
246
|
+
array_true = line.include?("array: true")
|
247
|
+
case name
|
248
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
249
|
+
next
|
250
|
+
else
|
251
|
+
case type
|
252
|
+
when "text", "date", "datetime"
|
253
|
+
if array_true
|
254
|
+
new_line.write " \"#{name.camelize(:lower)}\" => be_all(String),\n"
|
255
|
+
else
|
256
|
+
new_line.write " \"#{name.camelize(:lower)}\" => be_a(String),\n"
|
257
|
+
end
|
258
|
+
when "boolean"
|
259
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_in([true, false]),\n"
|
260
|
+
when "string", "bigint", "integer", "float"
|
261
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
if table_check(line: line, class_name: class_name)
|
266
|
+
@on = true
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
[file_path]
|
272
|
+
end
|
273
|
+
|
274
|
+
def rspec_resolver class_name: "souls"
|
275
|
+
singularized_class_name = class_name.singularize
|
276
|
+
file_path = "#{Dir.pwd}/spec/resolvers/#{singularized_class_name}_search_spec.rb"
|
277
|
+
return ["Resolver already exist! #{file_path}"] if File.exist? file_path
|
278
|
+
rspec_resolver_head class_name: singularized_class_name
|
279
|
+
rspec_resolver_after_head class_name: singularized_class_name
|
280
|
+
rspec_resolver_params class_name: singularized_class_name
|
281
|
+
rspec_resolver_end class_name: singularized_class_name
|
282
|
+
end
|
96
283
|
end
|
97
284
|
end
|
98
|
-
end
|
285
|
+
end
|
data/lib/souls/init.rb
CHANGED
@@ -114,11 +114,11 @@ module Souls
|
|
114
114
|
system "cp -r #{repository_name}-#{folder}/ #{app_name}/"
|
115
115
|
system "rm -rf #{version}.tar.gz && rm -rf #{repository_name}-#{folder}"
|
116
116
|
txt = <<~TEXT
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
_____ ____ __ ____#{' '}
|
118
|
+
/ ___// __ \\/ / / / / _____
|
119
|
+
\\__ \\/ / / / / / / / / ___/
|
120
|
+
___/ / /_/ / /_/ / /___(__ )#{' '}
|
121
|
+
/____/\\____/\\____/_____/____/#{' '}
|
122
122
|
TEXT
|
123
123
|
puts txt
|
124
124
|
puts "=============================="
|
@@ -724,7 +724,8 @@ module Souls
|
|
724
724
|
end
|
725
725
|
|
726
726
|
def rspec_factory class_name: "souls"
|
727
|
-
|
727
|
+
file_path = "./spec/factories/#{class_name.pluralize}.rb"
|
728
|
+
return ["Factory aleady exist! #{file_path}"] if File.exist? file_path
|
728
729
|
singularized_class_name = class_name.singularize
|
729
730
|
rspec_factory_head class_name: singularized_class_name
|
730
731
|
rspec_factory_params class_name: singularized_class_name
|
@@ -733,7 +734,7 @@ module Souls
|
|
733
734
|
|
734
735
|
def rspec_model class_name: "souls"
|
735
736
|
file_path = "./spec/models/#{class_name}_spec.rb"
|
736
|
-
return ["Aleady Exist!"]
|
737
|
+
return ["Aleady Exist!"] if File.exist? file_path
|
737
738
|
File.open(file_path, "w") do |f|
|
738
739
|
f.write <<~EOS
|
739
740
|
RSpec.describe "#{class_name.camelize} Model テスト", type: :model do
|
@@ -881,7 +882,12 @@ module Souls
|
|
881
882
|
end
|
882
883
|
|
883
884
|
it "return #{class_name.camelize} Data" do
|
884
|
-
|
885
|
+
begin
|
886
|
+
a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}Edge", "node")
|
887
|
+
raise unless a1.present?
|
888
|
+
rescue
|
889
|
+
raise StandardError, result
|
890
|
+
end
|
885
891
|
expect(a1).to include(
|
886
892
|
"id" => be_a(String),
|
887
893
|
EOS
|
@@ -899,7 +905,12 @@ module Souls
|
|
899
905
|
end
|
900
906
|
|
901
907
|
it "return #{class_name.camelize} Data" do
|
902
|
-
|
908
|
+
begin
|
909
|
+
a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}Edge", "node")
|
910
|
+
raise unless a1.present?
|
911
|
+
rescue
|
912
|
+
raise StandardError, result
|
913
|
+
end
|
903
914
|
expect(a1).to include(
|
904
915
|
"id" => be_a(String),
|
905
916
|
EOS
|
@@ -934,13 +945,13 @@ module Souls
|
|
934
945
|
File.open(file_path, "a") do |new_line|
|
935
946
|
File.open(path, "r") do |f|
|
936
947
|
f.each_line.with_index do |line, i|
|
937
|
-
if @on
|
948
|
+
if @on
|
938
949
|
if line.include?("end") || line.include?("t.index")
|
939
950
|
new_line.write <<~EOS
|
940
|
-
|
941
|
-
end
|
942
|
-
end
|
951
|
+
)
|
943
952
|
end
|
953
|
+
end
|
954
|
+
end
|
944
955
|
EOS
|
945
956
|
break
|
946
957
|
end
|
@@ -1006,7 +1017,7 @@ module Souls
|
|
1006
1017
|
if line.include?("end") || line.include?("t.index")
|
1007
1018
|
if @relation_params.empty?
|
1008
1019
|
new_line.write <<-EOS
|
1009
|
-
let(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
1020
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
1010
1021
|
|
1011
1022
|
let(:query) do
|
1012
1023
|
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
@@ -1051,7 +1062,7 @@ module Souls
|
|
1051
1062
|
File.open(file_path, "a") do |new_line|
|
1052
1063
|
File.open(path, "r") do |f|
|
1053
1064
|
f.each_line.with_index do |line, i|
|
1054
|
-
if @on
|
1065
|
+
if @on
|
1055
1066
|
if line.include?("end") || line.include?("t.index")
|
1056
1067
|
new_line.write <<-EOS
|
1057
1068
|
}
|
@@ -1064,7 +1075,12 @@ module Souls
|
|
1064
1075
|
end
|
1065
1076
|
|
1066
1077
|
it "return #{class_name.camelize} Data" do
|
1067
|
-
|
1078
|
+
begin
|
1079
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}")
|
1080
|
+
raise unless a1.present?
|
1081
|
+
rescue
|
1082
|
+
raise StandardError, result
|
1083
|
+
end
|
1068
1084
|
expect(a1).to include(
|
1069
1085
|
"id" => be_a(String),
|
1070
1086
|
EOS
|
@@ -1093,13 +1109,13 @@ module Souls
|
|
1093
1109
|
File.open(file_path, "a") do |new_line|
|
1094
1110
|
File.open(path, "r") do |f|
|
1095
1111
|
f.each_line.with_index do |line, i|
|
1096
|
-
if @on
|
1112
|
+
if @on
|
1097
1113
|
if line.include?("end") || line.include?("t.index")
|
1098
|
-
new_line.write
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
end
|
1114
|
+
new_line.write <<~EOS
|
1115
|
+
)
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
end
|
1103
1119
|
EOS
|
1104
1120
|
break
|
1105
1121
|
end
|
@@ -1174,20 +1190,24 @@ end
|
|
1174
1190
|
model_paths = model class_name: singularized_class_name
|
1175
1191
|
type_paths = type class_name: singularized_class_name
|
1176
1192
|
node_type_paths = node_type class_name: singularized_class_name
|
1193
|
+
resolver_paths = resolver class_name: singularized_class_name
|
1177
1194
|
rspec_factory_paths = rspec_factory class_name: singularized_class_name
|
1178
1195
|
rspec_model_paths = rspec_model class_name: singularized_class_name
|
1179
1196
|
rspec_mutation_paths = rspec_mutation class_name: singularized_class_name
|
1180
1197
|
rspec_query_paths = rspec_query class_name: singularized_class_name
|
1198
|
+
rspec_resolver_paths = rspec_resolver class_name: singularized_class_name
|
1181
1199
|
query_path = query class_name: singularized_class_name
|
1182
1200
|
mutation_path = mutation class_name: singularized_class_name
|
1183
1201
|
[
|
1184
1202
|
model: model_paths,
|
1185
1203
|
type: type_paths,
|
1204
|
+
resolver: resolver_paths,
|
1186
1205
|
node_type: node_type_paths,
|
1187
1206
|
rspec_factory: rspec_factory_paths,
|
1188
1207
|
rspec_model: rspec_model_paths,
|
1189
1208
|
rspec_mutation: rspec_mutation_paths,
|
1190
1209
|
rspec_query: rspec_query_paths,
|
1210
|
+
rspec_resolver: rspec_resolver_paths,
|
1191
1211
|
query: query_path,
|
1192
1212
|
mutation: mutation_path,
|
1193
1213
|
add_query_type: [
|
@@ -1199,6 +1219,9 @@ end
|
|
1199
1219
|
" field :update_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Update#{singularized_class_name.camelize}",
|
1200
1220
|
" field :delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Delete#{singularized_class_name.camelize}",
|
1201
1221
|
" field :destroy_delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::DestroyDelete#{singularized_class_name.camelize}"
|
1222
|
+
],
|
1223
|
+
add_resolver: [
|
1224
|
+
" field :#{singularized_class_name}_search, resolver: Revolvers::#{singularized_class_name.camelize}Search"
|
1202
1225
|
]
|
1203
1226
|
]
|
1204
1227
|
end
|
@@ -1208,11 +1231,13 @@ end
|
|
1208
1231
|
result = migrate class_name: class_name
|
1209
1232
|
puts result[0][:model]
|
1210
1233
|
puts result[0][:type]
|
1234
|
+
puts result[0][:resolver]
|
1211
1235
|
puts result[0][:node_type]
|
1212
1236
|
puts result[0][:rspec_factory]
|
1213
1237
|
puts result[0][:rspec_model]
|
1214
1238
|
puts result[0][:rspec_mutation]
|
1215
1239
|
puts result[0][:rspec_query]
|
1240
|
+
puts result[0][:rspec_resolver]
|
1216
1241
|
puts result[0][:query]
|
1217
1242
|
puts result[0][:mutation]
|
1218
1243
|
|
@@ -1226,6 +1251,10 @@ end
|
|
1226
1251
|
result[0][:add_query_type].each do |path|
|
1227
1252
|
puts path
|
1228
1253
|
end
|
1254
|
+
puts "\n ## Resolvers\n\n"
|
1255
|
+
result[0][:add_resolver].each do |path|
|
1256
|
+
puts path
|
1257
|
+
end
|
1229
1258
|
puts "\n ## Connection Type\n\n"
|
1230
1259
|
puts " def #{class_name.pluralize}"
|
1231
1260
|
puts " #{class_name.singularize.camelize}.all.order(id: :desc)"
|
@@ -1258,6 +1287,12 @@ end
|
|
1258
1287
|
path[:type].each { |line| puts line }
|
1259
1288
|
end
|
1260
1289
|
end
|
1290
|
+
puts "\n============== Resolver =======================\n\n"
|
1291
|
+
paths.each do |class_name|
|
1292
|
+
class_name.each do |path|
|
1293
|
+
path[:resolver].each { |line| puts line }
|
1294
|
+
end
|
1295
|
+
end
|
1261
1296
|
puts "\n============== NodeType =======================\n\n"
|
1262
1297
|
paths.each do |class_name|
|
1263
1298
|
class_name.each do |path|
|
@@ -1288,6 +1323,12 @@ end
|
|
1288
1323
|
path[:rspec_query].each { |line| puts line }
|
1289
1324
|
end
|
1290
1325
|
end
|
1326
|
+
puts "\n============== RspecResolver =================\n\n"
|
1327
|
+
paths.each do |class_name|
|
1328
|
+
class_name.each do |path|
|
1329
|
+
path[:rspec_resolver].each { |line| puts line }
|
1330
|
+
end
|
1331
|
+
end
|
1291
1332
|
puts "\n============== Query ======================\n\n"
|
1292
1333
|
paths.each do |class_name|
|
1293
1334
|
class_name.each do |path|
|
@@ -1312,6 +1353,12 @@ end
|
|
1312
1353
|
path[:add_query_type].each { |line| puts line }
|
1313
1354
|
end
|
1314
1355
|
end
|
1356
|
+
puts "\n ## Resolvers\n\n"
|
1357
|
+
paths.each do |class_name|
|
1358
|
+
class_name.each do |path|
|
1359
|
+
path[:add_resolver].each { |line| puts line }
|
1360
|
+
end
|
1361
|
+
end
|
1315
1362
|
puts "\n ## Connection Type\n\n"
|
1316
1363
|
get_tables.each do |class_name|
|
1317
1364
|
puts " def #{class_name.pluralize}"
|
data/lib/souls/version.rb
CHANGED
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.15.
|
4
|
+
version: 0.15.9
|
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: 2021-02-
|
13
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: SOULS is a Web Application Framework for Microservices on Multi Cloud
|
16
16
|
Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud.
|