souls 0.10.6 → 0.11.1
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 +3 -1
- data/Gemfile.lock +1 -1
- data/exe/souls +1 -1
- data/lib/souls.rb +1 -1
- data/lib/souls/init.rb +259 -5
- data/lib/souls/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae7581dc9bdd5395bcf08caaa70221c6a16dadf92260f983b6322e69210f4ef2
|
|
4
|
+
data.tar.gz: 9b6948571a0324e31ce4189a0c304e33ddf0d4a60cdd4f122b9a4e84ed5f8c6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df7192f836e9696628dcdd22d81de018cf6f9f6e5cb746f5e9cdd44d5d959e757fcbf89c57d8d7e34207f9b1180db2cac2104d79aea1198af3030d47522326c1
|
|
7
|
+
data.tar.gz: f1a56524a566aee14ed3bd61598d839c3f495cc0d3f29db529b33a505ade6323d0fb04800df0f5622dca1aab5568d2212edd0356a6678551d70e32ca6d3a734d
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/exe/souls
CHANGED
data/lib/souls.rb
CHANGED
data/lib/souls/init.rb
CHANGED
|
@@ -623,16 +623,262 @@ module Souls
|
|
|
623
623
|
[file_path]
|
|
624
624
|
end
|
|
625
625
|
|
|
626
|
+
def rspec_mutation_head class_name: "souls"
|
|
627
|
+
file_path = "./spec/mutations/#{class_name.pluralize}.rb"
|
|
628
|
+
File.open(file_path, "w") do |f|
|
|
629
|
+
f.write <<~EOS
|
|
630
|
+
RSpec.describe \"#{class_name.camelize} Mutation テスト\" do
|
|
631
|
+
describe "#{class_name.camelize} データを登録する" do
|
|
632
|
+
let!(:#{class_name.singularize.underscore}) { FactoryBot.create(:#{class_name.singularize.underscore}) }
|
|
633
|
+
|
|
634
|
+
let(:mutation) do
|
|
635
|
+
%(mutation {
|
|
636
|
+
create#{class_name.camelize}(input: {
|
|
637
|
+
EOS
|
|
638
|
+
end
|
|
639
|
+
end
|
|
640
|
+
|
|
641
|
+
def rspec_mutation_params class_name: "souls"
|
|
642
|
+
file_path = "./spec/mutations/#{class_name.pluralize}.rb"
|
|
643
|
+
path = "./db/schema.rb"
|
|
644
|
+
@on = false
|
|
645
|
+
File.open(file_path, "a") do |new_line|
|
|
646
|
+
File.open(path, "r") do |f|
|
|
647
|
+
f.each_line.with_index do |line, i|
|
|
648
|
+
if @on
|
|
649
|
+
if line.include?("end") || line.include?("t.index")
|
|
650
|
+
new_line.write " }) {\n #{class_name.singularize.camelize} {\n id\n"
|
|
651
|
+
break
|
|
652
|
+
end
|
|
653
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
654
|
+
case name
|
|
655
|
+
when "created_at", "updated_at"
|
|
656
|
+
next
|
|
657
|
+
else
|
|
658
|
+
case type
|
|
659
|
+
when "string", "text"
|
|
660
|
+
new_line.write " #{name.singularize.camelize(:lower)}: \"\#{#{class_name.singularize}.#{name.singularize.underscore}}\"\n"
|
|
661
|
+
when "bigint", "integer", "float", "boolean"
|
|
662
|
+
new_line.write " #{name.singularize.camelize(:lower)}: \#{#{class_name.singularize}.#{name.singularize.underscore}}\n"
|
|
663
|
+
when "date", "datetime"
|
|
664
|
+
new_line.write " #{name.singularize.camelize(:lower)}: \#{Time.now}\n"
|
|
665
|
+
end
|
|
666
|
+
end
|
|
667
|
+
end
|
|
668
|
+
if table_check(line: line, class_name: class_name)
|
|
669
|
+
@on = true
|
|
670
|
+
end
|
|
671
|
+
end
|
|
672
|
+
end
|
|
673
|
+
end
|
|
674
|
+
end
|
|
675
|
+
|
|
676
|
+
def rspec_mutation_params_response class_name: "souls"
|
|
677
|
+
file_path = "./spec/mutations/#{class_name.pluralize}.rb"
|
|
678
|
+
path = "./db/schema.rb"
|
|
679
|
+
@on = false
|
|
680
|
+
File.open(file_path, "a") do |new_line|
|
|
681
|
+
File.open(path, "r") do |f|
|
|
682
|
+
f.each_line.with_index do |line, i|
|
|
683
|
+
if @on
|
|
684
|
+
if line.include?("end") || line.include?("t.index")
|
|
685
|
+
new_line.write <<-EOS
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
)
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
subject(:result) do
|
|
693
|
+
SoulsApiSchema.execute(mutation).as_json
|
|
694
|
+
end
|
|
695
|
+
|
|
696
|
+
it "return #{class_name.camelize} Data" do
|
|
697
|
+
a1 = result.dig("data", "create#{class_name.camelize}", "#{class_name.singularize}")
|
|
698
|
+
expect(a1).to include(
|
|
699
|
+
"id" => be_a(String),
|
|
700
|
+
EOS
|
|
701
|
+
break
|
|
702
|
+
end
|
|
703
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
704
|
+
case name
|
|
705
|
+
when "created_at", "updated_at"
|
|
706
|
+
next
|
|
707
|
+
else
|
|
708
|
+
new_line.write " #{name.singularize.camelize(:lower)}\n"
|
|
709
|
+
end
|
|
710
|
+
end
|
|
711
|
+
if table_check(line: line, class_name: class_name)
|
|
712
|
+
@on = true
|
|
713
|
+
end
|
|
714
|
+
end
|
|
715
|
+
end
|
|
716
|
+
end
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
def rspec_mutation_end class_name: "souls"
|
|
720
|
+
file_path = "./spec/mutations/#{class_name.pluralize}.rb"
|
|
721
|
+
path = "./db/schema.rb"
|
|
722
|
+
@on = false
|
|
723
|
+
File.open(file_path, "a") do |new_line|
|
|
724
|
+
File.open(path, "r") do |f|
|
|
725
|
+
f.each_line.with_index do |line, i|
|
|
726
|
+
if @on
|
|
727
|
+
if line.include?("end") || line.include?("t.index")
|
|
728
|
+
new_line.write <<-EOS
|
|
729
|
+
)
|
|
730
|
+
end
|
|
731
|
+
end
|
|
732
|
+
end
|
|
733
|
+
EOS
|
|
734
|
+
break
|
|
735
|
+
end
|
|
736
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
737
|
+
field ||= type_check type
|
|
738
|
+
array_true = line.include?("array: true")
|
|
739
|
+
case name
|
|
740
|
+
when "created_at", "updated_at"
|
|
741
|
+
next
|
|
742
|
+
else
|
|
743
|
+
case type
|
|
744
|
+
when "text"
|
|
745
|
+
if array_true
|
|
746
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_all(String),\n"
|
|
747
|
+
end
|
|
748
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
|
749
|
+
when "string", "bigint", "integer", "float", "boolean"
|
|
750
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
|
751
|
+
when "date", "datetime"
|
|
752
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(DateTime),\n"
|
|
753
|
+
end
|
|
754
|
+
end
|
|
755
|
+
end
|
|
756
|
+
if table_check(line: line, class_name: class_name)
|
|
757
|
+
@on = true
|
|
758
|
+
end
|
|
759
|
+
end
|
|
760
|
+
end
|
|
761
|
+
end
|
|
762
|
+
[file_path]
|
|
763
|
+
end
|
|
764
|
+
|
|
626
765
|
def rspec_mutation class_name: "souls"
|
|
627
|
-
|
|
766
|
+
singularized_class_name = class_name.singularize
|
|
767
|
+
rspec_mutation_head class_name: singularized_class_name
|
|
768
|
+
rspec_mutation_params class_name: singularized_class_name
|
|
769
|
+
rspec_mutation_params_response class_name: singularized_class_name
|
|
770
|
+
rspec_mutation_end class_name: singularized_class_name
|
|
628
771
|
end
|
|
629
772
|
|
|
630
|
-
def
|
|
631
|
-
|
|
773
|
+
def rspec_query_head class_name: "souls"
|
|
774
|
+
file_path = "./spec/queries/#{class_name.pluralize}.rb"
|
|
775
|
+
File.open(file_path, "w") do |f|
|
|
776
|
+
f.write <<~EOS
|
|
777
|
+
RSpec.describe \"#{class_name.camelize} Query テスト\" do
|
|
778
|
+
describe "#{class_name.camelize} データを取得する" do
|
|
779
|
+
let!(:#{class_name.singularize.underscore}) { FactoryBot.create(:#{class_name.singularize.underscore}) }
|
|
780
|
+
|
|
781
|
+
let(:query) do
|
|
782
|
+
%(query {
|
|
783
|
+
#{class_name.camelize}(id: 1) {
|
|
784
|
+
id
|
|
785
|
+
EOS
|
|
786
|
+
end
|
|
632
787
|
end
|
|
633
788
|
|
|
634
|
-
|
|
635
|
-
|
|
789
|
+
def rspec_query_params class_name: "souls"
|
|
790
|
+
file_path = "./spec/queries/#{class_name.pluralize}.rb"
|
|
791
|
+
path = "./db/schema.rb"
|
|
792
|
+
@on = false
|
|
793
|
+
File.open(file_path, "a") do |new_line|
|
|
794
|
+
File.open(path, "r") do |f|
|
|
795
|
+
f.each_line.with_index do |line, i|
|
|
796
|
+
if @on
|
|
797
|
+
if line.include?("end") || line.include?("t.index")
|
|
798
|
+
new_line.write <<-EOS
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
)
|
|
802
|
+
end
|
|
803
|
+
|
|
804
|
+
subject(:result) do
|
|
805
|
+
SoulsApiSchema.execute(query).as_json
|
|
806
|
+
end
|
|
807
|
+
|
|
808
|
+
it "return #{class_name.camelize} Data" do
|
|
809
|
+
a1 = result.dig("data", "#{class_name.singularize.underscore}")
|
|
810
|
+
expect(a1).to include(
|
|
811
|
+
"id" => be_a(String),
|
|
812
|
+
EOS
|
|
813
|
+
break
|
|
814
|
+
end
|
|
815
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
816
|
+
case name
|
|
817
|
+
when "created_at", "updated_at"
|
|
818
|
+
next
|
|
819
|
+
else
|
|
820
|
+
new_line.write " #{name.singularize.camelize(:lower)}\n"
|
|
821
|
+
end
|
|
822
|
+
end
|
|
823
|
+
if table_check(line: line, class_name: class_name)
|
|
824
|
+
@on = true
|
|
825
|
+
end
|
|
826
|
+
end
|
|
827
|
+
end
|
|
828
|
+
end
|
|
829
|
+
end
|
|
830
|
+
|
|
831
|
+
def rspec_query_end class_name: "souls"
|
|
832
|
+
file_path = "./spec/queries/#{class_name.pluralize}.rb"
|
|
833
|
+
path = "./db/schema.rb"
|
|
834
|
+
@on = false
|
|
835
|
+
File.open(file_path, "a") do |new_line|
|
|
836
|
+
File.open(path, "r") do |f|
|
|
837
|
+
f.each_line.with_index do |line, i|
|
|
838
|
+
if @on
|
|
839
|
+
if line.include?("end") || line.include?("t.index")
|
|
840
|
+
new_line.write <<-EOS
|
|
841
|
+
)
|
|
842
|
+
end
|
|
843
|
+
end
|
|
844
|
+
end
|
|
845
|
+
EOS
|
|
846
|
+
break
|
|
847
|
+
end
|
|
848
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
849
|
+
field ||= type_check type
|
|
850
|
+
array_true = line.include?("array: true")
|
|
851
|
+
case name
|
|
852
|
+
when "created_at", "updated_at"
|
|
853
|
+
next
|
|
854
|
+
else
|
|
855
|
+
case type
|
|
856
|
+
when "text"
|
|
857
|
+
if array_true
|
|
858
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_all(String),\n"
|
|
859
|
+
end
|
|
860
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
|
861
|
+
when "string", "bigint", "integer", "float", "boolean"
|
|
862
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
|
863
|
+
when "date", "datetime"
|
|
864
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(DateTime),\n"
|
|
865
|
+
end
|
|
866
|
+
end
|
|
867
|
+
end
|
|
868
|
+
if table_check(line: line, class_name: class_name)
|
|
869
|
+
@on = true
|
|
870
|
+
end
|
|
871
|
+
end
|
|
872
|
+
end
|
|
873
|
+
end
|
|
874
|
+
[file_path]
|
|
875
|
+
end
|
|
876
|
+
|
|
877
|
+
def rspec_query class_name: "souls"
|
|
878
|
+
singularized_class_name = class_name.singularize
|
|
879
|
+
rspec_query_head class_name: singularized_class_name
|
|
880
|
+
rspec_query_params class_name: singularized_class_name
|
|
881
|
+
rspec_query_end class_name: singularized_class_name
|
|
636
882
|
end
|
|
637
883
|
|
|
638
884
|
def get_end_point
|
|
@@ -669,6 +915,7 @@ module Souls
|
|
|
669
915
|
type_paths = type class_name: singularized_class_name
|
|
670
916
|
rspec_factory_paths = rspec_factory class_name: singularized_class_name
|
|
671
917
|
rspec_model_paths = rspec_model class_name: singularized_class_name
|
|
918
|
+
rspec_mutation_paths = rspec_mutation class_name: singularized_class_name
|
|
672
919
|
query_path = query class_name: singularized_class_name
|
|
673
920
|
mutation_path = mutation class_name: singularized_class_name
|
|
674
921
|
[
|
|
@@ -676,6 +923,7 @@ module Souls
|
|
|
676
923
|
type: type_paths,
|
|
677
924
|
rspec_factory: rspec_factory_paths,
|
|
678
925
|
rspec_model: rspec_model_paths,
|
|
926
|
+
rspec_mutation: rspec_mutation_paths,
|
|
679
927
|
query: query_path,
|
|
680
928
|
mutation: mutation_path,
|
|
681
929
|
add_query_type: [
|
|
@@ -720,6 +968,12 @@ module Souls
|
|
|
720
968
|
path[:rspec_model].each { |line| puts line }
|
|
721
969
|
end
|
|
722
970
|
end
|
|
971
|
+
puts "\n============== RspecMutation =================\n\n"
|
|
972
|
+
paths.each do |class_name|
|
|
973
|
+
class_name.each do |path|
|
|
974
|
+
path[:rspec_mutation].each { |line| puts line }
|
|
975
|
+
end
|
|
976
|
+
end
|
|
723
977
|
puts "\n============== Query ======================\n\n"
|
|
724
978
|
paths.each do |class_name|
|
|
725
979
|
class_name.each do |path|
|
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.
|
|
4
|
+
version: 0.11.1
|
|
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-26 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,7 +69,7 @@ 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.
|
|
72
|
+
rubygems_version: 3.2.3
|
|
73
73
|
signing_key:
|
|
74
74
|
specification_version: 4
|
|
75
75
|
summary: SOULS is a Web Application Framework for Microservices on Multi Cloud Platform
|