souls 0.9.3 → 0.9.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/.rubocop.yml +4 -2
- data/Gemfile.lock +1 -1
- data/exe/souls +9 -6
- data/lib/souls.rb +1 -0
- data/lib/souls/init.rb +192 -76
- 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: 5426be38dac47ec1aed9a6dfad5cca1e57996bb84288d143c0e89e15490a48c4
|
|
4
|
+
data.tar.gz: 03c05301799061cd7e1929ddf117116ee3d8bba7c15aaa7db83bae62461669ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 539da594c3c5c147da4d5d549beda06fff35056197a3098fdb9361b70a7515a329b089f53a3ead10934cfbcba7f2be03933a2d88c972b5220263620f42b5c9ec
|
|
7
|
+
data.tar.gz: 7f016159015af63519cf9023db6e73614e66267be9d282c6bbf2233ff34a29685a9980a6093a67f6c5a9bdca028fad3c140e2949bd777e9c5eea19a004458c25
|
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.lock
CHANGED
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,15 +76,16 @@ begin
|
|
|
74
76
|
else
|
|
75
77
|
end
|
|
76
78
|
when "t", "test"
|
|
77
|
-
`rubocop`
|
|
78
|
-
`bundle exec rspec`
|
|
79
|
+
puts `rubocop`
|
|
80
|
+
puts `bundle exec rspec`
|
|
79
81
|
when "deploy"
|
|
80
82
|
project_id = Souls.configuration.project_id
|
|
81
83
|
`gcloud builds submit --config=cloudbuild.yml --project #{project_id}`
|
|
82
84
|
else
|
|
83
|
-
puts "Welcome to
|
|
85
|
+
puts "Welcome to SOULs!"
|
|
84
86
|
end
|
|
85
87
|
rescue StandardError => error
|
|
86
88
|
puts error
|
|
87
|
-
puts "Thank you
|
|
89
|
+
puts "Thank you!!"
|
|
90
|
+
puts "SOULs"
|
|
88
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,15 +251,17 @@ 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",
|
|
264
|
+
date: "GraphQL::Types::ISO8601DateTime",
|
|
263
265
|
boolean: "Boolean",
|
|
264
266
|
integer: "Integer"
|
|
265
267
|
}[type.to_sym]
|
|
@@ -268,36 +270,39 @@ module Souls
|
|
|
268
270
|
def get_test_type type
|
|
269
271
|
{
|
|
270
272
|
bigint: 1,
|
|
273
|
+
float: 4.2,
|
|
271
274
|
string: '"MyString"',
|
|
272
275
|
text: '"MyString"',
|
|
273
276
|
datetime: "Time.now",
|
|
277
|
+
date: "Time.now",
|
|
274
278
|
boolean: false,
|
|
275
279
|
integer: 1
|
|
276
280
|
}[type.to_sym]
|
|
277
281
|
end
|
|
278
282
|
|
|
279
283
|
def table_check line: "", class_name: ""
|
|
280
|
-
if line.include?("create_table")
|
|
281
|
-
return true
|
|
284
|
+
if line.include?("create_table") && (line.split(" ")[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
|
|
285
|
+
return true
|
|
282
286
|
end
|
|
283
287
|
false
|
|
284
288
|
end
|
|
285
289
|
|
|
286
290
|
def create_mutation_head class_name: "souls"
|
|
287
|
-
file_path = "./app/graphql/mutations/create_#{class_name}.rb"
|
|
291
|
+
file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
|
|
288
292
|
File.open(file_path, "w") do |new_line|
|
|
289
293
|
new_line.write <<~EOS
|
|
290
294
|
module Mutations
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
295
|
+
module #{class_name.camelize}
|
|
296
|
+
class Create#{class_name.camelize} < BaseMutation
|
|
297
|
+
field :#{class_name}, Types::#{class_name.camelize}Type, null: false
|
|
298
|
+
field :error, String, null: true
|
|
294
299
|
|
|
295
300
|
EOS
|
|
296
301
|
end
|
|
297
302
|
end
|
|
298
303
|
|
|
299
304
|
def create_mutation_params class_name: "souls"
|
|
300
|
-
file_path = "./app/graphql/mutations/create_#{class_name}.rb"
|
|
305
|
+
file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
|
|
301
306
|
path = "./db/schema.rb"
|
|
302
307
|
@on = false
|
|
303
308
|
File.open(file_path, "a") do |new_line|
|
|
@@ -305,13 +310,14 @@ module Souls
|
|
|
305
310
|
f.each_line.with_index do |line, i|
|
|
306
311
|
if @on
|
|
307
312
|
break if line.include?("end") || line.include?("t.index")
|
|
313
|
+
field = "[String]" if line.include?("array: true")
|
|
308
314
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
309
|
-
field
|
|
315
|
+
field ||= type_check type
|
|
310
316
|
case name
|
|
311
317
|
when "created_at", "updated_at"
|
|
312
318
|
next
|
|
313
319
|
else
|
|
314
|
-
new_line.write "
|
|
320
|
+
new_line.write " argument :#{name}, #{field}, required: false\n"
|
|
315
321
|
end
|
|
316
322
|
end
|
|
317
323
|
@on = true if table_check(line: line, class_name: class_name)
|
|
@@ -321,41 +327,43 @@ module Souls
|
|
|
321
327
|
end
|
|
322
328
|
|
|
323
329
|
def create_mutation_end class_name: "souls"
|
|
324
|
-
file_path = "./app/graphql/mutations/create_#{class_name}.rb"
|
|
330
|
+
file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
|
|
325
331
|
File.open(file_path, "a") do |new_line|
|
|
326
332
|
new_line.write <<~EOS
|
|
327
333
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
+
def resolve **args
|
|
335
|
+
#{class_name} = #{class_name.camelize}.new args
|
|
336
|
+
if #{class_name}.save
|
|
337
|
+
{ #{class_name}: #{class_name} }
|
|
338
|
+
else
|
|
339
|
+
{ error: #{class_name}.errors.full_messages }
|
|
340
|
+
end
|
|
341
|
+
rescue StandardError => error
|
|
342
|
+
GraphQL::ExecutionError.new error
|
|
334
343
|
end
|
|
335
|
-
rescue StandardError => error
|
|
336
|
-
GraphQL::ExecutionError.new error
|
|
337
344
|
end
|
|
338
345
|
end
|
|
339
346
|
end
|
|
340
347
|
EOS
|
|
341
348
|
end
|
|
342
|
-
|
|
349
|
+
file_path
|
|
343
350
|
end
|
|
344
351
|
|
|
345
352
|
def update_mutation_head class_name: "souls"
|
|
346
|
-
file_path = "./app/graphql/mutations/update_#{class_name}.rb"
|
|
353
|
+
file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
|
|
347
354
|
File.open(file_path, "w") do |new_line|
|
|
348
355
|
new_line.write <<~EOS
|
|
349
356
|
module Mutations
|
|
350
|
-
|
|
351
|
-
|
|
357
|
+
module #{class_name.camelize}
|
|
358
|
+
class Update#{class_name.camelize} < BaseMutation
|
|
359
|
+
field :#{class_name}, Types::#{class_name.camelize}Type, null: false
|
|
352
360
|
|
|
353
361
|
EOS
|
|
354
362
|
end
|
|
355
363
|
end
|
|
356
364
|
|
|
357
365
|
def update_mutation_params class_name: "souls"
|
|
358
|
-
file_path = "./app/graphql/mutations/update_#{class_name}.rb"
|
|
366
|
+
file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
|
|
359
367
|
path = "./db/schema.rb"
|
|
360
368
|
@on = false
|
|
361
369
|
File.open(file_path, "a") do |new_line|
|
|
@@ -363,13 +371,14 @@ module Souls
|
|
|
363
371
|
f.each_line.with_index do |line, i|
|
|
364
372
|
if @on
|
|
365
373
|
break if line.include?("end") || line.include?("t.index")
|
|
374
|
+
field = "[String]" if line.include?("array: true")
|
|
366
375
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
367
|
-
field
|
|
376
|
+
field ||= type_check type
|
|
368
377
|
case name
|
|
369
378
|
when "created_at", "updated_at"
|
|
370
379
|
next
|
|
371
380
|
else
|
|
372
|
-
new_line.write "
|
|
381
|
+
new_line.write " argument :#{name}, #{field}, required: false\n"
|
|
373
382
|
end
|
|
374
383
|
end
|
|
375
384
|
@on = true if table_check(line: line, class_name: class_name)
|
|
@@ -379,22 +388,23 @@ module Souls
|
|
|
379
388
|
end
|
|
380
389
|
|
|
381
390
|
def update_mutation_end class_name: "souls"
|
|
382
|
-
file_path = "./app/graphql/mutations/update_#{class_name}.rb"
|
|
391
|
+
file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
|
|
383
392
|
File.open(file_path, "a") do |new_line|
|
|
384
393
|
new_line.write <<~EOS
|
|
385
394
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
395
|
+
def resolve **args
|
|
396
|
+
#{class_name} = #{class_name.camelize}.find args[:id]
|
|
397
|
+
#{class_name}.update args
|
|
398
|
+
{ #{class_name}: #{class_name.camelize}.find(args[:id]) }
|
|
399
|
+
rescue StandardError => error
|
|
400
|
+
GraphQL::ExecutionError.new error
|
|
401
|
+
end
|
|
392
402
|
end
|
|
393
403
|
end
|
|
394
404
|
end
|
|
395
405
|
EOS
|
|
396
406
|
end
|
|
397
|
-
|
|
407
|
+
file_path
|
|
398
408
|
end
|
|
399
409
|
|
|
400
410
|
def update_mutation class_name: "souls"
|
|
@@ -404,35 +414,51 @@ module Souls
|
|
|
404
414
|
end
|
|
405
415
|
|
|
406
416
|
def delete_mutation class_name: "souls"
|
|
407
|
-
file_path = "./app/graphql/mutations/delete_#{class_name}.rb"
|
|
417
|
+
file_path = "./app/graphql/mutations/#{class_name}/delete_#{class_name}.rb"
|
|
408
418
|
File.open(file_path, "w") do |f|
|
|
409
419
|
f.write <<~EOS
|
|
410
420
|
module Mutations
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
+
module #{class_name.camelize}
|
|
422
|
+
class Delete#{class_name.camelize} < BaseMutation
|
|
423
|
+
field :#{class_name}, Types::#{class_name.camelize}Type, null: false
|
|
424
|
+
argument :id, Integer, required: true
|
|
425
|
+
|
|
426
|
+
def resolve id:
|
|
427
|
+
#{class_name} = #{class_name.camelize}.find id
|
|
428
|
+
#{class_name}.destroy
|
|
429
|
+
{ #{class_name}: #{class_name} }
|
|
430
|
+
rescue StandardError => error
|
|
431
|
+
GraphQL::ExecutionError.new error
|
|
432
|
+
end
|
|
421
433
|
end
|
|
422
434
|
end
|
|
423
435
|
end
|
|
424
436
|
EOS
|
|
425
437
|
end
|
|
426
|
-
|
|
438
|
+
file_path
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
def create_confirm
|
|
442
|
+
puts "Directory already exists, Overwrite?? (Y/N)"
|
|
443
|
+
input = STDIN.gets.chomp
|
|
444
|
+
return true if input == "Y"
|
|
445
|
+
raise StandardError.new "Directory Already Exist!"
|
|
427
446
|
end
|
|
428
447
|
|
|
429
448
|
def mutation class_name: "souls"
|
|
430
449
|
singularized_class_name = class_name.singularize
|
|
450
|
+
if Dir.exist? "./app/graphql/mutations/#{singularized_class_name}"
|
|
451
|
+
# create_confirm
|
|
452
|
+
FileUtils.rm_r("./app/graphql/mutations/#{singularized_class_name}")
|
|
453
|
+
end
|
|
454
|
+
Dir.mkdir "./app/graphql/mutations/#{singularized_class_name}"
|
|
431
455
|
create_mutation_head class_name: singularized_class_name
|
|
432
456
|
create_mutation_params class_name: singularized_class_name
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
457
|
+
[
|
|
458
|
+
create_mutation_end(class_name: singularized_class_name),
|
|
459
|
+
update_mutation(class_name: singularized_class_name),
|
|
460
|
+
delete_mutation(class_name: singularized_class_name)
|
|
461
|
+
]
|
|
436
462
|
end
|
|
437
463
|
|
|
438
464
|
def create_query class_name: "souls"
|
|
@@ -452,7 +478,7 @@ module Souls
|
|
|
452
478
|
end
|
|
453
479
|
EOS
|
|
454
480
|
end
|
|
455
|
-
|
|
481
|
+
file_path
|
|
456
482
|
end
|
|
457
483
|
|
|
458
484
|
def create_queries class_name: "souls"
|
|
@@ -472,14 +498,13 @@ module Souls
|
|
|
472
498
|
end
|
|
473
499
|
end
|
|
474
500
|
EOS
|
|
475
|
-
|
|
501
|
+
file_path
|
|
476
502
|
end
|
|
477
503
|
end
|
|
478
504
|
|
|
479
505
|
def query class_name: "souls"
|
|
480
506
|
singularized_class_name = class_name.singularize
|
|
481
|
-
create_query class_name: singularized_class_name
|
|
482
|
-
create_queries class_name: singularized_class_name
|
|
507
|
+
[create_query(class_name: singularized_class_name), create_queries(class_name: singularized_class_name)]
|
|
483
508
|
end
|
|
484
509
|
|
|
485
510
|
def create_type_head class_name: "souls"
|
|
@@ -503,8 +528,9 @@ module Souls
|
|
|
503
528
|
f.each_line.with_index do |line, i|
|
|
504
529
|
if @on
|
|
505
530
|
new_line.write "\n" && break if line.include?("end") || line.include?("t.index")
|
|
531
|
+
field = "[String]" if line.include?("array: true")
|
|
506
532
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
507
|
-
field
|
|
533
|
+
field ||= type_check type
|
|
508
534
|
new_line.write " field :#{name}, #{field}, null: true\n"
|
|
509
535
|
end
|
|
510
536
|
if table_check(line: line, class_name: class_name)
|
|
@@ -524,7 +550,7 @@ module Souls
|
|
|
524
550
|
end
|
|
525
551
|
EOS
|
|
526
552
|
end
|
|
527
|
-
|
|
553
|
+
[file_path]
|
|
528
554
|
end
|
|
529
555
|
|
|
530
556
|
def type class_name: "souls"
|
|
@@ -553,8 +579,9 @@ module Souls
|
|
|
553
579
|
f.each_line.with_index do |line, i|
|
|
554
580
|
if @on
|
|
555
581
|
new_line.write "\n" && break if line.include?("end") || line.include?("t.index")
|
|
582
|
+
field = '["tag1", "tag2", "tag3"]' if line.include?("array: true")
|
|
556
583
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
557
|
-
field
|
|
584
|
+
field ||= get_test_type type
|
|
558
585
|
new_line.write " #{name} { #{field} }\n"
|
|
559
586
|
end
|
|
560
587
|
if table_check(line: line, class_name: class_name)
|
|
@@ -573,7 +600,7 @@ module Souls
|
|
|
573
600
|
end
|
|
574
601
|
EOS
|
|
575
602
|
end
|
|
576
|
-
|
|
603
|
+
[file_path]
|
|
577
604
|
end
|
|
578
605
|
|
|
579
606
|
def rspec_factory class_name: "souls"
|
|
@@ -589,17 +616,12 @@ module Souls
|
|
|
589
616
|
f.write <<~EOS
|
|
590
617
|
RSpec.describe #{class_name.camelize}, type: :model do
|
|
591
618
|
it "作成する" do
|
|
592
|
-
expect(FactoryBot.build(:#{class_name})).to be_valid
|
|
593
|
-
end
|
|
594
|
-
|
|
595
|
-
it "同じtitleがあると作成できない" do
|
|
596
|
-
FactoryBot.build(:#{class_name}, title: "hey")
|
|
597
|
-
expect(FactoryBot.build(:#{class_name}, title: "hey")).to be_valid
|
|
619
|
+
expect(FactoryBot.build(:#{class_name.singularize})).to be_valid
|
|
598
620
|
end
|
|
599
621
|
end
|
|
600
622
|
EOS
|
|
601
623
|
end
|
|
602
|
-
|
|
624
|
+
[file_path]
|
|
603
625
|
end
|
|
604
626
|
|
|
605
627
|
def rspec_mutation class_name: "souls"
|
|
@@ -623,6 +645,17 @@ module Souls
|
|
|
623
645
|
end
|
|
624
646
|
end
|
|
625
647
|
|
|
648
|
+
def get_tables
|
|
649
|
+
path = "./db/schema.rb"
|
|
650
|
+
tables = []
|
|
651
|
+
File.open(path, "r") do |f|
|
|
652
|
+
f.each_line.with_index do |line, i|
|
|
653
|
+
tables << line.split("\"")[1] if line.include?("create_table")
|
|
654
|
+
end
|
|
655
|
+
end
|
|
656
|
+
tables
|
|
657
|
+
end
|
|
658
|
+
|
|
626
659
|
def add_mutation_type class_name: "souls"
|
|
627
660
|
# let's do this later
|
|
628
661
|
end
|
|
@@ -631,15 +664,98 @@ module Souls
|
|
|
631
664
|
# let's do this later
|
|
632
665
|
end
|
|
633
666
|
|
|
634
|
-
def
|
|
635
|
-
`rake db:migrate`
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
667
|
+
def migrate class_name: "souls"
|
|
668
|
+
# `rake db:migrate`
|
|
669
|
+
singularized_class_name = class_name.singularize
|
|
670
|
+
model_paths = model class_name: singularized_class_name
|
|
671
|
+
type_paths = type class_name: singularized_class_name
|
|
672
|
+
rspec_factory_paths = rspec_factory class_name: singularized_class_name
|
|
673
|
+
rspec_model_paths = rspec_model class_name: singularized_class_name
|
|
674
|
+
query_path = query class_name: singularized_class_name
|
|
675
|
+
mutation_path = mutation class_name: singularized_class_name
|
|
676
|
+
[
|
|
677
|
+
model: model_paths,
|
|
678
|
+
type: type_paths,
|
|
679
|
+
rspec_factory: rspec_factory_paths,
|
|
680
|
+
rspec_model: rspec_model_paths,
|
|
681
|
+
query: query_path,
|
|
682
|
+
mutation: mutation_path,
|
|
683
|
+
add_query_type: [
|
|
684
|
+
"field :#{singularized_class_name}, resolver: Queries::#{singularized_class_name.camelize}",
|
|
685
|
+
"field :#{singularized_class_name.pluralize}, Types::#{singularized_class_name.camelize}Type.connection_type, null: true"
|
|
686
|
+
],
|
|
687
|
+
add_mutation_type: [
|
|
688
|
+
"field :create_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Create#{singularized_class_name.camelize}",
|
|
689
|
+
"field :update_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Update#{singularized_class_name.camelize}",
|
|
690
|
+
"field :delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Delete#{singularized_class_name.camelize}"
|
|
691
|
+
]
|
|
692
|
+
]
|
|
693
|
+
end
|
|
694
|
+
|
|
695
|
+
def migrate_all
|
|
696
|
+
puts "◆◆◆ Let's Auto Generate CRUD API ◆◆◆\n"
|
|
697
|
+
paths = get_tables.map do |class_name|
|
|
698
|
+
migrate class_name: class_name
|
|
699
|
+
end
|
|
700
|
+
puts "\n============== Model ======================\n\n"
|
|
701
|
+
paths.each do |class_name|
|
|
702
|
+
class_name.each do |path|
|
|
703
|
+
path[:model].each { |line| puts line }
|
|
704
|
+
end
|
|
705
|
+
end
|
|
706
|
+
puts "\n============== Type =======================\n\n"
|
|
707
|
+
paths.each do |class_name|
|
|
708
|
+
class_name.each do |path|
|
|
709
|
+
path[:type].each { |line| puts line }
|
|
710
|
+
end
|
|
711
|
+
end
|
|
712
|
+
puts "\n============== FactoryBot =================\n\n"
|
|
713
|
+
paths.each do |class_name|
|
|
714
|
+
class_name.each do |path|
|
|
715
|
+
path[:rspec_factory].each { |line| puts line }
|
|
716
|
+
end
|
|
717
|
+
end
|
|
718
|
+
puts "\n============== RspecModel =================\n\n"
|
|
719
|
+
paths.each do |class_name|
|
|
720
|
+
class_name.each do |path|
|
|
721
|
+
path[:rspec_model].each { |line| puts line }
|
|
722
|
+
end
|
|
723
|
+
end
|
|
724
|
+
puts "\n============== Query ======================\n\n"
|
|
725
|
+
paths.each do |class_name|
|
|
726
|
+
class_name.each do |path|
|
|
727
|
+
path[:query].each { |line| puts line }
|
|
728
|
+
end
|
|
729
|
+
end
|
|
730
|
+
puts "\n============== Mutation ===================\n\n"
|
|
731
|
+
paths.each do |class_name|
|
|
732
|
+
class_name.each do |path|
|
|
733
|
+
path[:mutation].each { |line| puts line }
|
|
734
|
+
end
|
|
735
|
+
end
|
|
736
|
+
puts "\nAll files created from ./db/schema.rb"
|
|
737
|
+
puts "\n\n"
|
|
738
|
+
puts "\n##########################################################\n"
|
|
739
|
+
puts "# #\n"
|
|
740
|
+
puts "# Add These Lines at ./app/graphql/types/query_type.rb #\n"
|
|
741
|
+
puts "# #\n"
|
|
742
|
+
puts "##########################################################\n\n\n"
|
|
743
|
+
paths.each do |class_name|
|
|
744
|
+
class_name.each do |path|
|
|
745
|
+
path[:add_query_type].each { |line| puts line }
|
|
746
|
+
end
|
|
747
|
+
end
|
|
748
|
+
puts "\n#############################################################\n"
|
|
749
|
+
puts "# #\n"
|
|
750
|
+
puts "# Add These Lines at ./app/graphql/types/mutation_type.rb #\n"
|
|
751
|
+
puts "# #\n"
|
|
752
|
+
puts "#############################################################\n\n\n"
|
|
753
|
+
paths.each do |class_name|
|
|
754
|
+
class_name.each do |path|
|
|
755
|
+
path[:add_mutation_type].each { |line| puts line }
|
|
756
|
+
end
|
|
757
|
+
end
|
|
642
758
|
end
|
|
643
759
|
end
|
|
644
760
|
end
|
|
645
|
-
end
|
|
761
|
+
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.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-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.
|