souls 0.13.5 → 0.13.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 708f22e2d3efc407f65326eedb0ea4b8958e812b713b8e0a738b22ec9166660f
4
- data.tar.gz: f5eaa355fd1123c0c8e99ee4e9a591169716766c5f32667dd8c0ed3baa5ce2a5
3
+ metadata.gz: 074c5b354d039e12a5e400190e8268ea463ca5cb16e0b2dd0939060298dab8ca
4
+ data.tar.gz: fbdc806f48d8eede59f2a811db864d6df35950864f3c8c655ea49c52ca29b02b
5
5
  SHA512:
6
- metadata.gz: ebf255d21f902c2ad11d7f4869fc5d671e59065861f7865b4d0365f972a2336d8b92cfbd069ced29ab59f79cf3d824412a1fca119cb230e38f8bb9f467feb25d
7
- data.tar.gz: c2aa3e77d9f73278a5e1f4a73ebb4377de3e6e2d1f8451075df63b8158e85d6422f65c7f28d53fbcc0bb081060446b385040279899151fb4bcc29c78ac257f03
6
+ metadata.gz: a40cc9942ac7985c7015a99cf5ae542a8df1465cd0941e083c518ca625b31a0874e9b5d1ae3ce2de8777361e080c3c44bc8fc3a25f3fc8a7743d2795564018d1
7
+ data.tar.gz: badfbba685bdf59298195e2995a7c33577a5dadddb5580eb512d30d5ece1186e37806ba787aaf89ad41545159009de241f52827aefddf465fa504d6f6ec801be
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.13.4)
4
+ souls (0.13.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -12,20 +12,20 @@ GEM
12
12
  minitest (>= 5.1)
13
13
  tzinfo (~> 2.0)
14
14
  zeitwerk (~> 2.3)
15
- ast (2.4.1)
15
+ ast (2.4.2)
16
16
  ast_utils (0.3.0)
17
17
  parser (~> 2.4)
18
18
  thor (>= 0.19)
19
- concurrent-ruby (1.1.7)
19
+ concurrent-ruby (1.1.8)
20
20
  diff-lcs (1.4.4)
21
21
  ffi (1.14.2)
22
22
  i18n (1.8.7)
23
23
  concurrent-ruby (~> 1.0)
24
24
  language_server-protocol (3.15.0.1)
25
- listen (3.4.0)
25
+ listen (3.4.1)
26
26
  rb-fsevent (~> 0.10, >= 0.10.3)
27
27
  rb-inotify (~> 0.9, >= 0.9.10)
28
- minitest (5.14.2)
28
+ minitest (5.14.3)
29
29
  parallel (1.20.1)
30
30
  parser (2.7.2.0)
31
31
  ast (~> 2.4.1)
@@ -34,7 +34,7 @@ GEM
34
34
  rb-fsevent (0.10.4)
35
35
  rb-inotify (0.10.1)
36
36
  ffi (~> 1.0)
37
- rbs (1.0.0)
37
+ rbs (1.0.4)
38
38
  regexp_parser (2.0.3)
39
39
  rexml (3.2.4)
40
40
  rspec (3.1.0)
@@ -58,7 +58,7 @@ GEM
58
58
  rubocop-ast (>= 1.2.0, < 2.0)
59
59
  ruby-progressbar (~> 1.7)
60
60
  unicode-display_width (>= 1.4.0, < 2.0)
61
- rubocop-ast (1.4.0)
61
+ rubocop-ast (1.4.1)
62
62
  parser (>= 2.7.1.5)
63
63
  ruby-progressbar (1.11.0)
64
64
  steep (0.39.0)
@@ -69,7 +69,7 @@ GEM
69
69
  parser (~> 2.7.0)
70
70
  rainbow (>= 2.2.2, < 4.0)
71
71
  rbs (~> 1.0.0)
72
- thor (1.0.1)
72
+ thor (1.1.0)
73
73
  tzinfo (2.0.4)
74
74
  concurrent-ruby (~> 1.0)
75
75
  unicode-display_width (1.7.0)
data/exe/souls CHANGED
@@ -45,6 +45,8 @@ begin
45
45
  puts Souls::VERSION
46
46
  when "g", "generate"
47
47
  case ARGV[1]
48
+ when "test_dir"
49
+ Souls::Init.test_dir
48
50
  when "test"
49
51
  Souls::Init.single_migrate class_name: "user"
50
52
  when "model"
@@ -253,6 +253,19 @@ module Souls
253
253
  [file_path]
254
254
  end
255
255
 
256
+ def test_dir
257
+ FileUtils.mkdir_p "./app/graphql/mutations"
258
+ FileUtils.mkdir_p "./app/graphql/queries"
259
+ FileUtils.mkdir_p "./app/graphql/types"
260
+ FileUtils.mkdir_p "./spec/factories"
261
+ FileUtils.mkdir_p "./spec/queries"
262
+ FileUtils.mkdir_p "./spec/mutations"
263
+ FileUtils.mkdir_p "./spec/models"
264
+ FileUtils.mkdir_p "./db/"
265
+ FileUtils.touch "./db/schema.rb"
266
+ puts "test dir created!"
267
+ end
268
+
256
269
  def type_check type
257
270
  {
258
271
  bigint: "Integer",
@@ -305,6 +318,7 @@ module Souls
305
318
  path = "./db/schema.rb"
306
319
  @on = false
307
320
  @user_exist = false
321
+ @relation_params = []
308
322
  File.open(file_path, "a") do |new_line|
309
323
  File.open(path, "r") do |f|
310
324
  f.each_line.with_index do |line, i|
@@ -330,6 +344,9 @@ module Souls
330
344
  case name
331
345
  when "user_id"
332
346
  @user_exist = true
347
+ when /$*_id\z/
348
+ @relation_params << name
349
+ new_line.write " argument :#{name}, String, required: false\n"
333
350
  when "created_at", "updated_at"
334
351
  next
335
352
  else
@@ -340,6 +357,18 @@ module Souls
340
357
  end
341
358
  end
342
359
  end
360
+ @relation_params
361
+ end
362
+
363
+ def create_mutation_after_params class_name: "article", relation_params: []
364
+ return false if relation_params.empty?
365
+ file_path = "./app/graphql/mutations/#{class_name}/create_#{class_name}.rb"
366
+ relation_params.each do |params_name|
367
+ File.open(file_path, "a") do |new_line|
368
+ new_line.write " _, args[:#{params_name}] = SoulsApiSchema.from_global_id(args[:#{params_name}])\n"
369
+ end
370
+ end
371
+ true
343
372
  end
344
373
 
345
374
  def create_mutation_end class_name: "souls"
@@ -372,6 +401,7 @@ module Souls
372
401
  class Update#{class_name.camelize} < BaseMutation
373
402
  field :#{class_name}, Types::#{class_name.camelize}Type, null: false
374
403
 
404
+ argument :id, String, required: true
375
405
  EOS
376
406
  end
377
407
  end
@@ -381,6 +411,7 @@ module Souls
381
411
  path = "./db/schema.rb"
382
412
  @on = false
383
413
  @user_exist = false
414
+ @relation_params = []
384
415
  File.open(file_path, "a") do |new_line|
385
416
  File.open(path, "r") do |f|
386
417
  f.each_line.with_index do |line, i|
@@ -391,11 +422,13 @@ module Souls
391
422
 
392
423
  def resolve **args
393
424
  args[:user_id] = context[:user].id
425
+ _, args[:id] = SoulsApiSchema.from_global_id(args[:id])
394
426
  EOS
395
427
  else
396
428
  new_line.write <<-EOS
397
429
 
398
430
  def resolve **args
431
+ _, args[:id] = SoulsApiSchema.from_global_id(args[:id])
399
432
  EOS
400
433
  end
401
434
  break
@@ -406,6 +439,9 @@ module Souls
406
439
  case name
407
440
  when "user_id"
408
441
  @user_exist = true
442
+ when /$*_id\z/
443
+ @relation_params << name
444
+ new_line.write " argument :#{name}, String, required: false\n"
409
445
  when "created_at", "updated_at"
410
446
  next
411
447
  else
@@ -416,6 +452,18 @@ module Souls
416
452
  end
417
453
  end
418
454
  end
455
+ @relation_params
456
+ end
457
+
458
+ def update_mutation_after_params class_name: "article", relation_params: []
459
+ return false if relation_params.empty?
460
+ file_path = "./app/graphql/mutations/#{class_name}/update_#{class_name}.rb"
461
+ relation_params.each do |params_name|
462
+ File.open(file_path, "a") do |new_line|
463
+ new_line.write " _, args[:#{params_name}] = SoulsApiSchema.from_global_id(args[:#{params_name}])\n"
464
+ end
465
+ end
466
+ true
419
467
  end
420
468
 
421
469
  def update_mutation_end class_name: "souls"
@@ -438,7 +486,8 @@ module Souls
438
486
 
439
487
  def update_mutation class_name: "souls"
440
488
  update_mutation_head class_name: class_name
441
- update_mutation_params class_name: class_name
489
+ relation_params = update_mutation_params class_name: class_name
490
+ update_mutation_after_params class_name: class_name, relation_params: relation_params
442
491
  update_mutation_end class_name: class_name
443
492
  end
444
493
 
@@ -483,7 +532,8 @@ module Souls
483
532
  Dir.mkdir "./app/graphql/mutations/#{singularized_class_name}"
484
533
  end
485
534
  create_mutation_head class_name: singularized_class_name
486
- create_mutation_params class_name: singularized_class_name
535
+ relation_params = create_mutation_params class_name: singularized_class_name
536
+ create_mutation_after_params class_name: singularized_class_name, relation_params: relation_params
487
537
  [
488
538
  create_mutation_end(class_name: singularized_class_name),
489
539
  update_mutation(class_name: singularized_class_name),
@@ -562,7 +612,12 @@ module Souls
562
612
  field = "[String]" if line.include?("array: true")
563
613
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
564
614
  field ||= type_check type
565
- new_line.write " field :#{name}, #{field}, null: true\n"
615
+ case name
616
+ when /$*_id\z/
617
+ new_line.write " field :#{name.gsub("_id", "")}, Types::#{name.gsub("_id", "").singularize.camelize}Type, null: false\n"
618
+ else
619
+ new_line.write " field :#{name}, #{field}, null: true\n"
620
+ end
566
621
  end
567
622
  if table_check(line: line, class_name: class_name)
568
623
  @on = true
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.13.5"
2
+ VERSION = "0.13.6"
3
3
  end
@@ -1,4 +1,4 @@
1
- require_relative 'lib/souls/version'
1
+ require_relative "lib/souls/version"
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "souls"
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["POPPIN-FUMI", "KishiTheMechanic", "James Neve"]
7
7
  spec.email = ["fumitake.kawasaki@el-soul.com", "shota.kishi@el-soul.com", "jamesoneve@gmail.com"]
8
8
 
9
- spec.summary = "SOULS is a Web Application Framework for Microservices on Multi Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud. Auto deploy with scalable condition. You can focus on business logic. No more infra problems."
9
+ spec.summary = "SOULS is a GraphQL Based Web Application Framework for Microservices on Multi Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud. Auto deploy with scalable condition. You can focus on business logic. No more infra problems."
10
10
  spec.description = "SOULS is a Web Application Framework for Microservices on Multi Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud. Auto deploy with scalable condition. You can focus on business logic. No more infra problems."
11
11
  spec.homepage = "https://github.com/elsoul/souls"
12
12
  spec.license = "Apache-2.0"
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.13.5
4
+ version: 0.13.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-28 00:00:00.000000000 Z
13
+ date: 2021-01-31 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.
@@ -69,10 +69,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.2.3
72
+ rubygems_version: 3.2.4
73
73
  signing_key:
74
74
  specification_version: 4
75
- summary: SOULS is a Web Application Framework for Microservices on Multi Cloud Platform
76
- such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud. Auto deploy
77
- with scalable condition. You can focus on business logic. No more infra problems.
75
+ summary: SOULS is a GraphQL Based Web Application Framework for Microservices on Multi
76
+ Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud.
77
+ Auto deploy with scalable condition. You can focus on business logic. No more infra
78
+ problems.
78
79
  test_files: []