souls 0.15.2 → 0.15.7
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 +55 -26
- data/exe/souls +17 -13
- data/lib/souls/generate.rb +201 -15
- data/lib/souls/init.rb +56 -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: abe6a8a19db79936b013516a4d13714d8b5f40dbd1936b3348c84954b3464f46
|
4
|
+
data.tar.gz: 79b82ca41a79fdfcd56794b3bb329a905abfdac0fcecc5075973a53700b5a9c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53e0e8479c8e0d935f55a5119ebc1af3f61b0ac40476dd36e291196c69bc025822eaa37213ef6ecdfcba182c163ecb3d1e2b76e1c6af497b3823c0f3e77b8115
|
7
|
+
data.tar.gz: b6216fca804c81d140712a9ee7c01c926d034a10c5d84d3990e83491bb0fbea2d8ab7896465b4267bfa4edf4f2330b109376d6a6125e6a749ef660c419ebb3a6
|
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,67 @@ 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
|
+
# Version Check
|
83
|
+
$ souls -v
|
77
84
|
|
78
|
-
|
85
|
+
# Init SOULs App
|
86
|
+
$ souls new app_name
|
87
|
+
$ cd app_name
|
88
|
+
$ bundle
|
79
89
|
|
80
|
-
|
90
|
+
# Run Dev & Test DB
|
91
|
+
$ souls i run_psql
|
81
92
|
|
82
|
-
|
93
|
+
# Create DB
|
94
|
+
$ souls db:create
|
83
95
|
|
84
|
-
|
96
|
+
# Migrate DB
|
97
|
+
$ souls db:migrate
|
85
98
|
|
86
|
-
|
99
|
+
# Create Test DB
|
100
|
+
$ souls db:seed
|
87
101
|
|
88
|
-
|
102
|
+
# Development (localhost:3000/playground)
|
103
|
+
$ souls s
|
89
104
|
|
90
|
-
|
105
|
+
# Development with Worker (localhost:3000/playground; localhost:3000/sidekiq)
|
106
|
+
$ foreman start -f Procfile.dev
|
91
107
|
|
92
|
-
|
108
|
+
# Test
|
109
|
+
$ bundle exec rspec
|
93
110
|
|
94
|
-
|
111
|
+
# Deploy (Edit: ./cloudbuild.yml)
|
112
|
+
$ souls deploy
|
95
113
|
|
96
|
-
|
114
|
+
# Run Infra Command
|
115
|
+
$ souls i `method_name`
|
116
|
+
```
|
117
|
+
|
118
|
+
## SOULs Scaffold
|
119
|
+
SOULs Scaffold creates CRUD API from `./db/schema.rb`
|
97
120
|
|
98
|
-
|
121
|
+
```bash
|
122
|
+
# Create migration file
|
123
|
+
$ souls g migration user
|
99
124
|
|
100
|
-
|
125
|
+
# Edit migration file
|
126
|
+
# Migrate DB
|
127
|
+
$ souls db:migrate
|
128
|
+
|
129
|
+
# SOULs Scaffold
|
130
|
+
$ souls g migrate user
|
131
|
+
```
|
101
132
|
|
102
|
-
Update
|
103
133
|
|
104
|
-
$ souls i update
|
105
134
|
|
106
135
|
## Development
|
107
136
|
|
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]
|
@@ -66,7 +66,7 @@ begin
|
|
66
66
|
when "migrate_all"
|
67
67
|
Souls::Init.migrate_all
|
68
68
|
when "migration"
|
69
|
-
`rake db:create_migration NAME=#{ARGV[2]}`
|
69
|
+
STDOUT.write `rake db:create_migration NAME=#{ARGV[2]}`
|
70
70
|
when "rspec_factory"
|
71
71
|
Souls::Init.rspec_factory class_name: ARGV[2]
|
72
72
|
when "rspec_model"
|
@@ -77,24 +77,28 @@ 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
|
83
85
|
when "db:create"
|
84
|
-
`rake db:create && rake db:create RACK_ENV=test`
|
86
|
+
STDOUT.write `rake db:create && rake db:create RACK_ENV=test`
|
85
87
|
when "db:migrate"
|
86
|
-
`rake db:migrate && rake db:migrate RACK_ENV=test`
|
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
|
-
`rake db:migrate:reset && rake db:migrate:reset RACK_ENV=test`
|
92
|
+
STDOUT.write `rake db:migrate:reset && rake db:migrate:reset RACK_ENV=test`
|
89
93
|
when "t", "test"
|
90
|
-
`rubocop`
|
91
|
-
`bundle exec rspec`
|
94
|
+
STDOUT.write `rubocop`
|
95
|
+
STDOUT.write `bundle exec rspec`
|
92
96
|
when "run"
|
93
|
-
`docker build . -t souls:latest`
|
94
|
-
`docker run --rm -p 3000:3000 souls:latest`
|
97
|
+
STDOUT.write `docker build . -t souls:latest`
|
98
|
+
STDOUT.write `docker run --rm -p 3000:3000 souls:latest`
|
95
99
|
when "deploy"
|
96
100
|
project_id = Souls.configuration.project_id
|
97
|
-
`gcloud builds submit --config=cloudbuild.yml --project #{project_id}`
|
101
|
+
STDOUT.write `gcloud builds submit --config=cloudbuild.yml --project #{project_id}`
|
98
102
|
else
|
99
103
|
puts "Welcome to SOULs!"
|
100
104
|
end
|
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,207 @@ 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
|
+
File.open(file_path, "w") do |f|
|
103
|
+
f.write <<~EOS
|
104
|
+
RSpec.describe \"#{class_name.camelize}Search Resolver テスト\" do
|
105
|
+
describe "削除フラグ false の #{class_name.camelize} を返却する" do
|
106
|
+
EOS
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def rspec_resolver_after_head class_name: "souls"
|
111
|
+
file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
|
112
|
+
path = "./db/schema.rb"
|
113
|
+
@on = false
|
114
|
+
@user_exist = false
|
115
|
+
@relation_params = []
|
116
|
+
File.open(file_path, "a") do |new_line|
|
117
|
+
File.open(path, "r") do |f|
|
118
|
+
f.each_line.with_index do |line, i|
|
119
|
+
if @on
|
120
|
+
if line.include?("end") || line.include?("t.index")
|
121
|
+
if @relation_params.empty?
|
122
|
+
new_line.write <<-EOS
|
123
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
124
|
+
|
125
|
+
let(:query) do
|
126
|
+
%(query {
|
127
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
128
|
+
isDeleted: false
|
129
|
+
}) {
|
130
|
+
edges {
|
131
|
+
cursor
|
132
|
+
node {
|
133
|
+
id
|
134
|
+
EOS
|
135
|
+
else
|
136
|
+
new_line.write <<-EOS
|
137
|
+
let(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(", ")}) }
|
138
|
+
|
139
|
+
let(:query) do
|
140
|
+
%(query {
|
141
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
142
|
+
isDeleted: false
|
143
|
+
}) {
|
144
|
+
edges {
|
145
|
+
cursor
|
146
|
+
node {
|
147
|
+
id
|
148
|
+
EOS
|
149
|
+
end
|
150
|
+
break
|
151
|
+
end
|
152
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
153
|
+
case name
|
154
|
+
when /$*_id\z/
|
155
|
+
relation_col = name.gsub("_id", "")
|
156
|
+
@relation_params << "#{name}: #{relation_col}.id"
|
157
|
+
new_line.write " let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
if table_check(line: line, class_name: class_name)
|
161
|
+
@on = true
|
162
|
+
end
|
89
163
|
end
|
90
164
|
end
|
91
|
-
|
165
|
+
end
|
92
166
|
end
|
93
|
-
|
167
|
+
|
168
|
+
def rspec_resolver_params class_name: "souls"
|
169
|
+
file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
|
170
|
+
path = "./db/schema.rb"
|
171
|
+
@on = false
|
172
|
+
File.open(file_path, "a") do |new_line|
|
173
|
+
File.open(path, "r") do |f|
|
174
|
+
f.each_line.with_index do |line, i|
|
175
|
+
if @on
|
176
|
+
if line.include?("end") || line.include?("t.index")
|
177
|
+
new_line.write <<-EOS
|
178
|
+
}
|
179
|
+
}
|
180
|
+
nodes {
|
181
|
+
id
|
182
|
+
}
|
183
|
+
pageInfo {
|
184
|
+
endCursor
|
185
|
+
hasNextPage
|
186
|
+
startCursor
|
187
|
+
hasPreviousPage
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
)
|
94
192
|
end
|
95
193
|
|
194
|
+
subject(:result) do
|
195
|
+
SoulsApiSchema.execute(query).as_json
|
196
|
+
end
|
197
|
+
|
198
|
+
it "return #{class_name.camelize} Data" do
|
199
|
+
begin
|
200
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
|
201
|
+
raise unless a1.present?
|
202
|
+
rescue
|
203
|
+
raise StandardError, result
|
204
|
+
end
|
205
|
+
expect(a1).to include(
|
206
|
+
"id" => be_a(String),
|
207
|
+
EOS
|
208
|
+
break
|
209
|
+
end
|
210
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
211
|
+
case name
|
212
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
213
|
+
next
|
214
|
+
else
|
215
|
+
new_line.write " #{name.camelize(:lower)}\n"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
if table_check(line: line, class_name: class_name)
|
219
|
+
@on = true
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def rspec_resolver_end class_name: "souls"
|
227
|
+
file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
|
228
|
+
path = "./db/schema.rb"
|
229
|
+
@on = false
|
230
|
+
File.open(file_path, "a") do |new_line|
|
231
|
+
File.open(path, "r") do |f|
|
232
|
+
f.each_line.with_index do |line, i|
|
233
|
+
if @on
|
234
|
+
if line.include?("end") || line.include?("t.index")
|
235
|
+
new_line.write <<-EOS
|
236
|
+
)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
EOS
|
241
|
+
break
|
242
|
+
end
|
243
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
244
|
+
field ||= type_check type
|
245
|
+
array_true = line.include?("array: true")
|
246
|
+
case name
|
247
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
248
|
+
next
|
249
|
+
else
|
250
|
+
case type
|
251
|
+
when "text", "date", "datetime"
|
252
|
+
if array_true
|
253
|
+
new_line.write " \"#{name.camelize(:lower)}\" => be_all(String),\n"
|
254
|
+
else
|
255
|
+
new_line.write " \"#{name.camelize(:lower)}\" => be_a(String),\n"
|
256
|
+
end
|
257
|
+
when "boolean"
|
258
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_in([true, false]),\n"
|
259
|
+
when "string", "bigint", "integer", "float"
|
260
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
if table_check(line: line, class_name: class_name)
|
265
|
+
@on = true
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
[file_path]
|
271
|
+
end
|
272
|
+
|
273
|
+
def rspec_resolver class_name: "souls"
|
274
|
+
singularized_class_name = class_name.singularize
|
275
|
+
file_path = "#{Dir.pwd}/spec/resolvers/#{singularized_class_name}_search_spec.rb"
|
276
|
+
return ["Resolver already exist! #{file_path}"] if File.exist? file_path
|
277
|
+
rspec_resolver_head class_name: singularized_class_name
|
278
|
+
rspec_resolver_after_head class_name: singularized_class_name
|
279
|
+
rspec_resolver_params class_name: singularized_class_name
|
280
|
+
rspec_resolver_end class_name: singularized_class_name
|
281
|
+
end
|
96
282
|
end
|
97
283
|
end
|
98
|
-
end
|
284
|
+
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: [
|
@@ -1208,11 +1228,13 @@ end
|
|
1208
1228
|
result = migrate class_name: class_name
|
1209
1229
|
puts result[0][:model]
|
1210
1230
|
puts result[0][:type]
|
1231
|
+
puts result[0][:resolver]
|
1211
1232
|
puts result[0][:node_type]
|
1212
1233
|
puts result[0][:rspec_factory]
|
1213
1234
|
puts result[0][:rspec_model]
|
1214
1235
|
puts result[0][:rspec_mutation]
|
1215
1236
|
puts result[0][:rspec_query]
|
1237
|
+
puts result[0][:rspec_resolver]
|
1216
1238
|
puts result[0][:query]
|
1217
1239
|
puts result[0][:mutation]
|
1218
1240
|
|
@@ -1258,6 +1280,12 @@ end
|
|
1258
1280
|
path[:type].each { |line| puts line }
|
1259
1281
|
end
|
1260
1282
|
end
|
1283
|
+
puts "\n============== Resolver =======================\n\n"
|
1284
|
+
paths.each do |class_name|
|
1285
|
+
class_name.each do |path|
|
1286
|
+
path[:resovler].each { |line| puts line }
|
1287
|
+
end
|
1288
|
+
end
|
1261
1289
|
puts "\n============== NodeType =======================\n\n"
|
1262
1290
|
paths.each do |class_name|
|
1263
1291
|
class_name.each do |path|
|
@@ -1288,6 +1316,12 @@ end
|
|
1288
1316
|
path[:rspec_query].each { |line| puts line }
|
1289
1317
|
end
|
1290
1318
|
end
|
1319
|
+
puts "\n============== RspecResolver =================\n\n"
|
1320
|
+
paths.each do |class_name|
|
1321
|
+
class_name.each do |path|
|
1322
|
+
path[:rspec_resolver].each { |line| puts line }
|
1323
|
+
end
|
1324
|
+
end
|
1291
1325
|
puts "\n============== Query ======================\n\n"
|
1292
1326
|
paths.each do |class_name|
|
1293
1327
|
class_name.each do |path|
|
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.7
|
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.
|