souls 0.9.0 → 0.9.6
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/.rubocop.yml +4 -2
- data/Gemfile +1 -0
- data/Gemfile.lock +18 -1
- data/exe/souls +9 -13
- data/lib/souls.rb +1 -0
- data/lib/souls/init.rb +180 -66
- 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: 76d16e22f896d21fad8dee314b75ddc65e42507d8fdabd494ed8f250ec785457
|
|
4
|
+
data.tar.gz: 022b54f4f66325a19fb8877662411d6d4d00cf667bc2c04d83222dd77bffa1da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c3a5949f7b388f5bdd8863070e2704d25f4e94bc62f7434838b24b11c2cddacbe68d009ab6d089d518e5343e3f6c40d969333c926fc445df034435418ba450a
|
|
7
|
+
data.tar.gz: 0d0131a7ac137d5fb15f502b2b863e7d666e7aa71796981f93b0b5c60dd1738cf6e5a40bded2e33c9fd766b2458a3d1e501f9b94716206d37c21bf163dd9210d
|
data/.rubocop.yml
CHANGED
|
@@ -133,7 +133,7 @@ Metrics/AbcSize:
|
|
|
133
133
|
Enabled: false
|
|
134
134
|
|
|
135
135
|
Metrics/CyclomaticComplexity:
|
|
136
|
-
Max:
|
|
136
|
+
Max: 30
|
|
137
137
|
|
|
138
138
|
Metrics/PerceivedComplexity:
|
|
139
139
|
Enabled: false
|
|
@@ -203,4 +203,6 @@ Style/DateTime:
|
|
|
203
203
|
Enabled: false
|
|
204
204
|
Layout/HeredocIndentation:
|
|
205
205
|
Exclude:
|
|
206
|
-
- "lib/souls/init.rb"
|
|
206
|
+
- "lib/souls/init.rb"
|
|
207
|
+
Style/RaiseArgs:
|
|
208
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
souls (0.
|
|
4
|
+
souls (0.9.4)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -26,6 +26,7 @@ GEM
|
|
|
26
26
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
27
27
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
28
28
|
minitest (5.14.2)
|
|
29
|
+
parallel (1.20.1)
|
|
29
30
|
parser (2.7.2.0)
|
|
30
31
|
ast (~> 2.4.1)
|
|
31
32
|
rainbow (3.0.0)
|
|
@@ -34,6 +35,8 @@ GEM
|
|
|
34
35
|
rb-inotify (0.10.1)
|
|
35
36
|
ffi (~> 1.0)
|
|
36
37
|
rbs (1.0.0)
|
|
38
|
+
regexp_parser (2.0.3)
|
|
39
|
+
rexml (3.2.4)
|
|
37
40
|
rspec (3.1.0)
|
|
38
41
|
rspec-core (~> 3.1.0)
|
|
39
42
|
rspec-expectations (~> 3.1.0)
|
|
@@ -46,6 +49,18 @@ GEM
|
|
|
46
49
|
rspec-mocks (3.1.3)
|
|
47
50
|
rspec-support (~> 3.1.0)
|
|
48
51
|
rspec-support (3.1.2)
|
|
52
|
+
rubocop (1.7.0)
|
|
53
|
+
parallel (~> 1.10)
|
|
54
|
+
parser (>= 2.7.1.5)
|
|
55
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
56
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
57
|
+
rexml
|
|
58
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
59
|
+
ruby-progressbar (~> 1.7)
|
|
60
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
61
|
+
rubocop-ast (1.4.0)
|
|
62
|
+
parser (>= 2.7.1.5)
|
|
63
|
+
ruby-progressbar (1.11.0)
|
|
49
64
|
steep (0.39.0)
|
|
50
65
|
activesupport (>= 5.1)
|
|
51
66
|
ast_utils (~> 0.3.0)
|
|
@@ -57,6 +72,7 @@ GEM
|
|
|
57
72
|
thor (1.0.1)
|
|
58
73
|
tzinfo (2.0.4)
|
|
59
74
|
concurrent-ruby (~> 1.0)
|
|
75
|
+
unicode-display_width (1.7.0)
|
|
60
76
|
zeitwerk (2.4.2)
|
|
61
77
|
|
|
62
78
|
PLATFORMS
|
|
@@ -66,6 +82,7 @@ DEPENDENCIES
|
|
|
66
82
|
activesupport (= 6.1.0)
|
|
67
83
|
rake (= 13.0.3)
|
|
68
84
|
rspec (= 3.1.0)
|
|
85
|
+
rubocop (= 1.7.0)
|
|
69
86
|
souls!
|
|
70
87
|
steep (= 0.39.0)
|
|
71
88
|
|
data/exe/souls
CHANGED
|
@@ -48,7 +48,7 @@ begin
|
|
|
48
48
|
when "g", "generate"
|
|
49
49
|
case ARGV[1]
|
|
50
50
|
when "test"
|
|
51
|
-
Souls::Init.
|
|
51
|
+
Souls::Init.get_tables
|
|
52
52
|
when "model"
|
|
53
53
|
Souls::Init.model class_name: ARGV[2]
|
|
54
54
|
when "mutation"
|
|
@@ -58,7 +58,9 @@ begin
|
|
|
58
58
|
when "type"
|
|
59
59
|
Souls::Init.type class_name: ARGV[2]
|
|
60
60
|
when "migrate"
|
|
61
|
-
Souls::Init.
|
|
61
|
+
Souls::Init.migrate class_name: ARGV[2]
|
|
62
|
+
when "migrate_all"
|
|
63
|
+
Souls::Init.migrate_all
|
|
62
64
|
when "migration"
|
|
63
65
|
`rake db:create_migration NAME=#{ARGV[3]}`
|
|
64
66
|
when "rspec_factory"
|
|
@@ -74,22 +76,16 @@ begin
|
|
|
74
76
|
else
|
|
75
77
|
end
|
|
76
78
|
when "t", "test"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`bundle exec rspec`
|
|
80
|
-
when "-s"
|
|
81
|
-
`bundle exec steep check`
|
|
82
|
-
else
|
|
83
|
-
`bundle exec steep check`
|
|
84
|
-
`bundle exec rspec`
|
|
85
|
-
end
|
|
79
|
+
puts `rubocop`
|
|
80
|
+
puts `bundle exec rspec`
|
|
86
81
|
when "deploy"
|
|
87
82
|
project_id = Souls.configuration.project_id
|
|
88
83
|
`gcloud builds submit --config=cloudbuild.yml --project #{project_id}`
|
|
89
84
|
else
|
|
90
|
-
puts "Welcome to
|
|
85
|
+
puts "Welcome to SOULs!"
|
|
91
86
|
end
|
|
92
87
|
rescue StandardError => error
|
|
93
88
|
puts error
|
|
94
|
-
puts "Thank you
|
|
89
|
+
puts "Thank you!!"
|
|
90
|
+
puts "SOULs"
|
|
95
91
|
end
|
data/lib/souls.rb
CHANGED
data/lib/souls/init.rb
CHANGED
|
@@ -115,11 +115,11 @@ module Souls
|
|
|
115
115
|
system "cp -r #{repository_name}-#{folder}/ #{app_name}/"
|
|
116
116
|
system "rm -rf #{version}.tar.gz && rm -rf #{repository_name}-#{folder}"
|
|
117
117
|
txt = <<~TEXT
|
|
118
|
-
_____ ____ __ ____
|
|
118
|
+
_____ ____ __ ____#{' '}
|
|
119
119
|
/ ___// __ \\/ / / / / _____
|
|
120
120
|
\\__ \\/ / / / / / / / / ___/
|
|
121
|
-
___/ / /_/ / /_/ / /___(__ )
|
|
122
|
-
/____/\\____/\\____/_____/____
|
|
121
|
+
___/ / /_/ / /_/ / /___(__ )#{' '}
|
|
122
|
+
/____/\\____/\\____/_____/____/#{' '}
|
|
123
123
|
TEXT
|
|
124
124
|
puts txt
|
|
125
125
|
puts "=============================="
|
|
@@ -251,13 +251,14 @@ module Souls
|
|
|
251
251
|
end
|
|
252
252
|
EOS
|
|
253
253
|
end
|
|
254
|
-
|
|
254
|
+
[file_path]
|
|
255
255
|
end
|
|
256
256
|
|
|
257
257
|
def type_check type
|
|
258
258
|
{
|
|
259
259
|
bigint: "Integer",
|
|
260
260
|
string: "String",
|
|
261
|
+
float: "Float",
|
|
261
262
|
text: "String",
|
|
262
263
|
datetime: "GraphQL::Types::ISO8601DateTime",
|
|
263
264
|
boolean: "Boolean",
|
|
@@ -277,27 +278,28 @@ module Souls
|
|
|
277
278
|
end
|
|
278
279
|
|
|
279
280
|
def table_check line: "", class_name: ""
|
|
280
|
-
if line.include?("create_table")
|
|
281
|
-
return true
|
|
281
|
+
if line.include?("create_table") && (line.split(" ")[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
|
|
282
|
+
return true
|
|
282
283
|
end
|
|
283
284
|
false
|
|
284
285
|
end
|
|
285
286
|
|
|
286
287
|
def create_mutation_head class_name: "souls"
|
|
287
|
-
file_path = "./app/graphql/mutations/create_#{class_name}.rb"
|
|
288
|
+
file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
|
|
288
289
|
File.open(file_path, "w") do |new_line|
|
|
289
290
|
new_line.write <<~EOS
|
|
290
291
|
module Mutations
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
module #{class_name.camelize}
|
|
293
|
+
class Create#{class_name.camelize} < BaseMutation
|
|
294
|
+
field :#{class_name}, Types::#{class_name.camelize}Type, null: false
|
|
295
|
+
field :error, String, null: true
|
|
294
296
|
|
|
295
297
|
EOS
|
|
296
298
|
end
|
|
297
299
|
end
|
|
298
300
|
|
|
299
301
|
def create_mutation_params class_name: "souls"
|
|
300
|
-
file_path = "./app/graphql/mutations/create_#{class_name}.rb"
|
|
302
|
+
file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
|
|
301
303
|
path = "./db/schema.rb"
|
|
302
304
|
@on = false
|
|
303
305
|
File.open(file_path, "a") do |new_line|
|
|
@@ -311,7 +313,7 @@ module Souls
|
|
|
311
313
|
when "created_at", "updated_at"
|
|
312
314
|
next
|
|
313
315
|
else
|
|
314
|
-
new_line.write "
|
|
316
|
+
new_line.write " argument :#{name}, #{field}, required: false\n"
|
|
315
317
|
end
|
|
316
318
|
end
|
|
317
319
|
@on = true if table_check(line: line, class_name: class_name)
|
|
@@ -321,41 +323,43 @@ module Souls
|
|
|
321
323
|
end
|
|
322
324
|
|
|
323
325
|
def create_mutation_end class_name: "souls"
|
|
324
|
-
file_path = "./app/graphql/mutations/create_#{class_name}.rb"
|
|
326
|
+
file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
|
|
325
327
|
File.open(file_path, "a") do |new_line|
|
|
326
328
|
new_line.write <<~EOS
|
|
327
329
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
330
|
+
def resolve **args
|
|
331
|
+
#{class_name} = #{class_name.camelize}.new args
|
|
332
|
+
if #{class_name}.save
|
|
333
|
+
{ #{class_name}: #{class_name} }
|
|
334
|
+
else
|
|
335
|
+
{ error: #{class_name}.errors.full_messages }
|
|
336
|
+
end
|
|
337
|
+
rescue StandardError => error
|
|
338
|
+
GraphQL::ExecutionError.new error
|
|
334
339
|
end
|
|
335
|
-
rescue StandardError => error
|
|
336
|
-
GraphQL::ExecutionError.new error
|
|
337
340
|
end
|
|
338
341
|
end
|
|
339
342
|
end
|
|
340
343
|
EOS
|
|
341
344
|
end
|
|
342
|
-
|
|
345
|
+
file_path
|
|
343
346
|
end
|
|
344
347
|
|
|
345
348
|
def update_mutation_head class_name: "souls"
|
|
346
|
-
file_path = "./app/graphql/mutations/update_#{class_name}.rb"
|
|
349
|
+
file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
|
|
347
350
|
File.open(file_path, "w") do |new_line|
|
|
348
351
|
new_line.write <<~EOS
|
|
349
352
|
module Mutations
|
|
350
|
-
|
|
351
|
-
|
|
353
|
+
module #{class_name.camelize}
|
|
354
|
+
class Update#{class_name.camelize} < BaseMutation
|
|
355
|
+
field :#{class_name}, Types::#{class_name.camelize}Type, null: false
|
|
352
356
|
|
|
353
357
|
EOS
|
|
354
358
|
end
|
|
355
359
|
end
|
|
356
360
|
|
|
357
361
|
def update_mutation_params class_name: "souls"
|
|
358
|
-
file_path = "./app/graphql/mutations/update_#{class_name}.rb"
|
|
362
|
+
file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
|
|
359
363
|
path = "./db/schema.rb"
|
|
360
364
|
@on = false
|
|
361
365
|
File.open(file_path, "a") do |new_line|
|
|
@@ -369,7 +373,7 @@ module Souls
|
|
|
369
373
|
when "created_at", "updated_at"
|
|
370
374
|
next
|
|
371
375
|
else
|
|
372
|
-
new_line.write "
|
|
376
|
+
new_line.write " argument :#{name}, #{field}, required: false\n"
|
|
373
377
|
end
|
|
374
378
|
end
|
|
375
379
|
@on = true if table_check(line: line, class_name: class_name)
|
|
@@ -379,22 +383,23 @@ module Souls
|
|
|
379
383
|
end
|
|
380
384
|
|
|
381
385
|
def update_mutation_end class_name: "souls"
|
|
382
|
-
file_path = "./app/graphql/mutations/update_#{class_name}.rb"
|
|
386
|
+
file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
|
|
383
387
|
File.open(file_path, "a") do |new_line|
|
|
384
388
|
new_line.write <<~EOS
|
|
385
389
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
def resolve **args
|
|
391
|
+
#{class_name} = #{class_name.camelize}.find args[:id]
|
|
392
|
+
#{class_name}.update args
|
|
393
|
+
{ #{class_name}: #{class_name.camelize}.find(args[:id]) }
|
|
394
|
+
rescue StandardError => error
|
|
395
|
+
GraphQL::ExecutionError.new error
|
|
396
|
+
end
|
|
392
397
|
end
|
|
393
398
|
end
|
|
394
399
|
end
|
|
395
400
|
EOS
|
|
396
401
|
end
|
|
397
|
-
|
|
402
|
+
file_path
|
|
398
403
|
end
|
|
399
404
|
|
|
400
405
|
def update_mutation class_name: "souls"
|
|
@@ -404,35 +409,51 @@ module Souls
|
|
|
404
409
|
end
|
|
405
410
|
|
|
406
411
|
def delete_mutation class_name: "souls"
|
|
407
|
-
file_path = "./app/graphql/mutations/delete_#{class_name}.rb"
|
|
412
|
+
file_path = "./app/graphql/mutations/#{class_name}/delete_#{class_name}.rb"
|
|
408
413
|
File.open(file_path, "w") do |f|
|
|
409
414
|
f.write <<~EOS
|
|
410
415
|
module Mutations
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
416
|
+
module #{class_name.camelize}
|
|
417
|
+
class Delete#{class_name.camelize} < BaseMutation
|
|
418
|
+
field :#{class_name}, Types::#{class_name.camelize}Type, null: false
|
|
419
|
+
argument :id, Integer, required: true
|
|
420
|
+
|
|
421
|
+
def resolve id:
|
|
422
|
+
#{class_name} = #{class_name.camelize}.find id
|
|
423
|
+
#{class_name}.destroy
|
|
424
|
+
{ #{class_name}: #{class_name} }
|
|
425
|
+
rescue StandardError => error
|
|
426
|
+
GraphQL::ExecutionError.new error
|
|
427
|
+
end
|
|
421
428
|
end
|
|
422
429
|
end
|
|
423
430
|
end
|
|
424
431
|
EOS
|
|
425
432
|
end
|
|
426
|
-
|
|
433
|
+
file_path
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
def create_confirm
|
|
437
|
+
puts "Directory already exists, Overwrite?? (Y/N)"
|
|
438
|
+
input = STDIN.gets.chomp
|
|
439
|
+
return true if input == "Y"
|
|
440
|
+
raise StandardError.new "Directory Already Exist!"
|
|
427
441
|
end
|
|
428
442
|
|
|
429
443
|
def mutation class_name: "souls"
|
|
430
444
|
singularized_class_name = class_name.singularize
|
|
445
|
+
if Dir.exist? "./app/graphql/mutations/#{singularized_class_name}"
|
|
446
|
+
# create_confirm
|
|
447
|
+
FileUtils.rm_r("./app/graphql/mutations/#{singularized_class_name}")
|
|
448
|
+
end
|
|
449
|
+
Dir.mkdir "./app/graphql/mutations/#{singularized_class_name}"
|
|
431
450
|
create_mutation_head class_name: singularized_class_name
|
|
432
451
|
create_mutation_params class_name: singularized_class_name
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
452
|
+
[
|
|
453
|
+
create_mutation_end(class_name: singularized_class_name),
|
|
454
|
+
update_mutation(class_name: singularized_class_name),
|
|
455
|
+
delete_mutation(class_name: singularized_class_name)
|
|
456
|
+
]
|
|
436
457
|
end
|
|
437
458
|
|
|
438
459
|
def create_query class_name: "souls"
|
|
@@ -452,7 +473,7 @@ module Souls
|
|
|
452
473
|
end
|
|
453
474
|
EOS
|
|
454
475
|
end
|
|
455
|
-
|
|
476
|
+
file_path
|
|
456
477
|
end
|
|
457
478
|
|
|
458
479
|
def create_queries class_name: "souls"
|
|
@@ -472,14 +493,13 @@ module Souls
|
|
|
472
493
|
end
|
|
473
494
|
end
|
|
474
495
|
EOS
|
|
475
|
-
|
|
496
|
+
file_path
|
|
476
497
|
end
|
|
477
498
|
end
|
|
478
499
|
|
|
479
500
|
def query class_name: "souls"
|
|
480
501
|
singularized_class_name = class_name.singularize
|
|
481
|
-
create_query class_name: singularized_class_name
|
|
482
|
-
create_queries class_name: singularized_class_name
|
|
502
|
+
[create_query(class_name: singularized_class_name), create_queries(class_name: singularized_class_name)]
|
|
483
503
|
end
|
|
484
504
|
|
|
485
505
|
def create_type_head class_name: "souls"
|
|
@@ -524,7 +544,7 @@ module Souls
|
|
|
524
544
|
end
|
|
525
545
|
EOS
|
|
526
546
|
end
|
|
527
|
-
|
|
547
|
+
[file_path]
|
|
528
548
|
end
|
|
529
549
|
|
|
530
550
|
def type class_name: "souls"
|
|
@@ -573,7 +593,7 @@ module Souls
|
|
|
573
593
|
end
|
|
574
594
|
EOS
|
|
575
595
|
end
|
|
576
|
-
|
|
596
|
+
[file_path]
|
|
577
597
|
end
|
|
578
598
|
|
|
579
599
|
def rspec_factory class_name: "souls"
|
|
@@ -599,7 +619,7 @@ module Souls
|
|
|
599
619
|
end
|
|
600
620
|
EOS
|
|
601
621
|
end
|
|
602
|
-
|
|
622
|
+
[file_path]
|
|
603
623
|
end
|
|
604
624
|
|
|
605
625
|
def rspec_mutation class_name: "souls"
|
|
@@ -623,6 +643,17 @@ module Souls
|
|
|
623
643
|
end
|
|
624
644
|
end
|
|
625
645
|
|
|
646
|
+
def get_tables
|
|
647
|
+
path = "./db/schema.rb"
|
|
648
|
+
tables = []
|
|
649
|
+
File.open(path, "r") do |f|
|
|
650
|
+
f.each_line.with_index do |line, i|
|
|
651
|
+
tables << line.split("\"")[1] if line.include?("create_table")
|
|
652
|
+
end
|
|
653
|
+
end
|
|
654
|
+
tables
|
|
655
|
+
end
|
|
656
|
+
|
|
626
657
|
def add_mutation_type class_name: "souls"
|
|
627
658
|
# let's do this later
|
|
628
659
|
end
|
|
@@ -631,15 +662,98 @@ module Souls
|
|
|
631
662
|
# let's do this later
|
|
632
663
|
end
|
|
633
664
|
|
|
634
|
-
def
|
|
635
|
-
`rake db:migrate`
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
665
|
+
def migrate class_name: "souls"
|
|
666
|
+
# `rake db:migrate`
|
|
667
|
+
singularized_class_name = class_name.singularize
|
|
668
|
+
model_paths = model class_name: singularized_class_name
|
|
669
|
+
type_paths = type class_name: singularized_class_name
|
|
670
|
+
rspec_factory_paths = rspec_factory class_name: singularized_class_name
|
|
671
|
+
rspec_model_paths = rspec_model class_name: singularized_class_name
|
|
672
|
+
query_path = query class_name: singularized_class_name
|
|
673
|
+
mutation_path = mutation class_name: singularized_class_name
|
|
674
|
+
[
|
|
675
|
+
model: model_paths,
|
|
676
|
+
type: type_paths,
|
|
677
|
+
rspec_factory: rspec_factory_paths,
|
|
678
|
+
rspec_model: rspec_model_paths,
|
|
679
|
+
query: query_path,
|
|
680
|
+
mutation: mutation_path,
|
|
681
|
+
add_query_type: [
|
|
682
|
+
"field :#{singularized_class_name}, resolver: Queries::#{singularized_class_name.camelize}",
|
|
683
|
+
"field :#{singularized_class_name.pluralize}, Types::#{singularized_class_name.camelize}Type.connection_type, null: true"
|
|
684
|
+
],
|
|
685
|
+
add_mutation_type: [
|
|
686
|
+
"field :create_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Create#{singularized_class_name.camelize}",
|
|
687
|
+
"field :update_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Update#{singularized_class_name.camelize}",
|
|
688
|
+
"field :delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Delete#{singularized_class_name.camelize}"
|
|
689
|
+
]
|
|
690
|
+
]
|
|
691
|
+
end
|
|
692
|
+
|
|
693
|
+
def migrate_all
|
|
694
|
+
puts "◆◆◆ Let's Auto Generate CRUD API ◆◆◆\n"
|
|
695
|
+
paths = get_tables.map do |class_name|
|
|
696
|
+
migrate class_name: class_name
|
|
697
|
+
end
|
|
698
|
+
puts "\n============== Model ======================\n\n"
|
|
699
|
+
paths.each do |class_name|
|
|
700
|
+
class_name.each do |path|
|
|
701
|
+
path[:model].each { |line| puts line }
|
|
702
|
+
end
|
|
703
|
+
end
|
|
704
|
+
puts "\n============== Type =======================\n\n"
|
|
705
|
+
paths.each do |class_name|
|
|
706
|
+
class_name.each do |path|
|
|
707
|
+
path[:type].each { |line| puts line }
|
|
708
|
+
end
|
|
709
|
+
end
|
|
710
|
+
puts "\n============== FactoryBot =================\n\n"
|
|
711
|
+
paths.each do |class_name|
|
|
712
|
+
class_name.each do |path|
|
|
713
|
+
path[:rspec_factory].each { |line| puts line }
|
|
714
|
+
end
|
|
715
|
+
end
|
|
716
|
+
puts "\n============== RspecModel =================\n\n"
|
|
717
|
+
paths.each do |class_name|
|
|
718
|
+
class_name.each do |path|
|
|
719
|
+
path[:rspec_model].each { |line| puts line }
|
|
720
|
+
end
|
|
721
|
+
end
|
|
722
|
+
puts "\n============== Query ======================\n\n"
|
|
723
|
+
paths.each do |class_name|
|
|
724
|
+
class_name.each do |path|
|
|
725
|
+
path[:query].each { |line| puts line }
|
|
726
|
+
end
|
|
727
|
+
end
|
|
728
|
+
puts "\n============== Mutation ===================\n\n"
|
|
729
|
+
paths.each do |class_name|
|
|
730
|
+
class_name.each do |path|
|
|
731
|
+
path[:mutation].each { |line| puts line }
|
|
732
|
+
end
|
|
733
|
+
end
|
|
734
|
+
puts "\nAll files created from ./db/schema.rb"
|
|
735
|
+
puts "\n\n"
|
|
736
|
+
puts "\n##########################################################\n"
|
|
737
|
+
puts "# #\n"
|
|
738
|
+
puts "# Add These Lines at ./app/graphql/types/query_type.rb #\n"
|
|
739
|
+
puts "# #\n"
|
|
740
|
+
puts "##########################################################\n\n\n"
|
|
741
|
+
paths.each do |class_name|
|
|
742
|
+
class_name.each do |path|
|
|
743
|
+
path[:add_query_type].each { |line| puts line }
|
|
744
|
+
end
|
|
745
|
+
end
|
|
746
|
+
puts "\n#############################################################\n"
|
|
747
|
+
puts "# #\n"
|
|
748
|
+
puts "# Add These Lines at ./app/graphql/types/mutation_type.rb #\n"
|
|
749
|
+
puts "# #\n"
|
|
750
|
+
puts "#############################################################\n\n\n"
|
|
751
|
+
paths.each do |class_name|
|
|
752
|
+
class_name.each do |path|
|
|
753
|
+
path[:add_mutation_type].each { |line| puts line }
|
|
754
|
+
end
|
|
755
|
+
end
|
|
642
756
|
end
|
|
643
757
|
end
|
|
644
758
|
end
|
|
645
|
-
end
|
|
759
|
+
end
|
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.9.
|
|
4
|
+
version: 0.9.6
|
|
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-01-
|
|
13
|
+
date: 2021-01-22 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.
|