souls 0.11.1 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae7581dc9bdd5395bcf08caaa70221c6a16dadf92260f983b6322e69210f4ef2
4
- data.tar.gz: 9b6948571a0324e31ce4189a0c304e33ddf0d4a60cdd4f122b9a4e84ed5f8c6b
3
+ metadata.gz: b747eb0e08952160caac3d82ead74a6b34edc888b3eb70daa3b14ad68af71d32
4
+ data.tar.gz: 92b397aefa6281bc880067825be471fb88b600b54ec48bdfeba23e3821375a1f
5
5
  SHA512:
6
- metadata.gz: df7192f836e9696628dcdd22d81de018cf6f9f6e5cb746f5e9cdd44d5d959e757fcbf89c57d8d7e34207f9b1180db2cac2104d79aea1198af3030d47522326c1
7
- data.tar.gz: f1a56524a566aee14ed3bd61598d839c3f495cc0d3f29db529b33a505ade6323d0fb04800df0f5622dca1aab5568d2212edd0356a6678551d70e32ca6d3a734d
6
+ metadata.gz: 475336d2d3b71384447c25c013e7393e9b8f2e18d0296776c593199d865fbe54461bb96cad0c785e05cf5bf4b5c519272efddca96b499cd7f99e5a8237608ff6
7
+ data.tar.gz: fbb79ab9c131547f8834c63f093cd055f568ee0bbd42b884b1c5f99193ed56f701fb60ee57c4cdb48d2f5390d5c08fc04e9c659ac3c10ead377dda4586557a1c
@@ -133,7 +133,7 @@ Metrics/AbcSize:
133
133
  Enabled: false
134
134
 
135
135
  Metrics/CyclomaticComplexity:
136
- Max: 30
136
+ Max: 40
137
137
 
138
138
  Metrics/PerceivedComplexity:
139
139
  Enabled: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.11.0)
4
+ souls (0.11.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -460,7 +460,7 @@ module Souls
460
460
  ]
461
461
  end
462
462
 
463
- def create_query class_name: "souls"
463
+ def create_queries class_name: "souls"
464
464
  file_path = "./app/graphql/queries/#{class_name.pluralize}.rb"
465
465
  File.open(file_path, "w") do |f|
466
466
  f.write <<~EOS
@@ -480,17 +480,18 @@ module Souls
480
480
  file_path
481
481
  end
482
482
 
483
- def create_queries class_name: "souls"
483
+ def create_query class_name: "souls"
484
484
  file_path = "./app/graphql/queries/#{class_name}.rb"
485
485
  File.open(file_path, "w") do |f|
486
486
  f.write <<~EOS
487
487
  module Queries
488
488
  class #{class_name.camelize} < Queries::BaseQuery
489
489
  type Types::#{class_name.camelize}Type, null: false
490
- argument :id, Integer, required: true
490
+ argument :id, String, required: true
491
491
 
492
- def resolve id:
493
- ::#{class_name.camelize}.find(id)
492
+ def resolve **args
493
+ _, #{class_name.singularize.underscore}_id = SoulsApiSchema.from_global_id args[:id]
494
+ ::#{class_name.camelize}.find(#{class_name.singularize.underscore}_id)
494
495
  rescue StandardError => error
495
496
  GraphQL::ExecutionError.new error
496
497
  end
@@ -624,7 +625,7 @@ module Souls
624
625
  end
625
626
 
626
627
  def rspec_mutation_head class_name: "souls"
627
- file_path = "./spec/mutations/#{class_name.pluralize}.rb"
628
+ file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
628
629
  File.open(file_path, "w") do |f|
629
630
  f.write <<~EOS
630
631
  RSpec.describe \"#{class_name.camelize} Mutation テスト\" do
@@ -639,7 +640,7 @@ module Souls
639
640
  end
640
641
 
641
642
  def rspec_mutation_params class_name: "souls"
642
- file_path = "./spec/mutations/#{class_name.pluralize}.rb"
643
+ file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
643
644
  path = "./db/schema.rb"
644
645
  @on = false
645
646
  File.open(file_path, "a") do |new_line|
@@ -674,7 +675,7 @@ module Souls
674
675
  end
675
676
 
676
677
  def rspec_mutation_params_response class_name: "souls"
677
- file_path = "./spec/mutations/#{class_name.pluralize}.rb"
678
+ file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
678
679
  path = "./db/schema.rb"
679
680
  @on = false
680
681
  File.open(file_path, "a") do |new_line|
@@ -717,7 +718,7 @@ module Souls
717
718
  end
718
719
 
719
720
  def rspec_mutation_end class_name: "souls"
720
- file_path = "./spec/mutations/#{class_name.pluralize}.rb"
721
+ file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
721
722
  path = "./db/schema.rb"
722
723
  @on = false
723
724
  File.open(file_path, "a") do |new_line|
@@ -771,7 +772,7 @@ end
771
772
  end
772
773
 
773
774
  def rspec_query_head class_name: "souls"
774
- file_path = "./spec/queries/#{class_name.pluralize}.rb"
775
+ file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
775
776
  File.open(file_path, "w") do |f|
776
777
  f.write <<~EOS
777
778
  RSpec.describe \"#{class_name.camelize} Query テスト\" do
@@ -780,14 +781,14 @@ end
780
781
 
781
782
  let(:query) do
782
783
  %(query {
783
- #{class_name.camelize}(id: 1) {
784
+ #{class_name.singularize.underscore}(id: \#{Base64.encode64("#{class_name.camelize}:\#{#{class_name.underscore}.id}")}) {
784
785
  id
785
786
  EOS
786
787
  end
787
788
  end
788
789
 
789
790
  def rspec_query_params class_name: "souls"
790
- file_path = "./spec/queries/#{class_name.pluralize}.rb"
791
+ file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
791
792
  path = "./db/schema.rb"
792
793
  @on = false
793
794
  File.open(file_path, "a") do |new_line|
@@ -829,7 +830,7 @@ end
829
830
  end
830
831
 
831
832
  def rspec_query_end class_name: "souls"
832
- file_path = "./spec/queries/#{class_name.pluralize}.rb"
833
+ file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
833
834
  path = "./db/schema.rb"
834
835
  @on = false
835
836
  File.open(file_path, "a") do |new_line|
@@ -916,6 +917,7 @@ end
916
917
  rspec_factory_paths = rspec_factory class_name: singularized_class_name
917
918
  rspec_model_paths = rspec_model class_name: singularized_class_name
918
919
  rspec_mutation_paths = rspec_mutation class_name: singularized_class_name
920
+ rspec_query_paths = rspec_query class_name: singularized_class_name
919
921
  query_path = query class_name: singularized_class_name
920
922
  mutation_path = mutation class_name: singularized_class_name
921
923
  [
@@ -924,6 +926,7 @@ end
924
926
  rspec_factory: rspec_factory_paths,
925
927
  rspec_model: rspec_model_paths,
926
928
  rspec_mutation: rspec_mutation_paths,
929
+ rspec_query: rspec_query_paths,
927
930
  query: query_path,
928
931
  mutation: mutation_path,
929
932
  add_query_type: [
@@ -940,7 +943,6 @@ end
940
943
 
941
944
  def migrate_all
942
945
  puts "◆◆◆ Let's Auto Generate CRUD API ◆◆◆\n"
943
- `rake db:migrate`
944
946
  paths = get_tables.map do |class_name|
945
947
  migrate class_name: class_name.singularize
946
948
  end
@@ -974,6 +976,12 @@ end
974
976
  path[:rspec_mutation].each { |line| puts line }
975
977
  end
976
978
  end
979
+ puts "\n============== RspecQuery =================\n\n"
980
+ paths.each do |class_name|
981
+ class_name.each do |path|
982
+ path[:rspec_query].each { |line| puts line }
983
+ end
984
+ end
977
985
  puts "\n============== Query ======================\n\n"
978
986
  paths.each do |class_name|
979
987
  class_name.each do |path|
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.11.1"
2
+ VERSION = "0.11.6"
3
3
  end
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.11.1
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI