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 +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/souls/init.rb +22 -14
- data/lib/souls/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b747eb0e08952160caac3d82ead74a6b34edc888b3eb70daa3b14ad68af71d32
|
|
4
|
+
data.tar.gz: 92b397aefa6281bc880067825be471fb88b600b54ec48bdfeba23e3821375a1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 475336d2d3b71384447c25c013e7393e9b8f2e18d0296776c593199d865fbe54461bb96cad0c785e05cf5bf4b5c519272efddca96b499cd7f99e5a8237608ff6
|
|
7
|
+
data.tar.gz: fbb79ab9c131547f8834c63f093cd055f568ee0bbd42b884b1c5f99193ed56f701fb60ee57c4cdb48d2f5390d5c08fc04e9c659ac3c10ead377dda4586557a1c
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/souls/init.rb
CHANGED
|
@@ -460,7 +460,7 @@ module Souls
|
|
|
460
460
|
]
|
|
461
461
|
end
|
|
462
462
|
|
|
463
|
-
def
|
|
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
|
|
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,
|
|
490
|
+
argument :id, String, required: true
|
|
491
491
|
|
|
492
|
-
def resolve
|
|
493
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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|
|
data/lib/souls/version.rb
CHANGED