souls 0.10.6 → 0.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -1
- data/exe/souls +1 -1
- data/lib/souls.rb +1 -1
- data/lib/souls/init.rb +144 -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: 7c64bef1b432a5f2480396310ec48cd750fc14e8a8f967e93562be1a80427b8f
|
4
|
+
data.tar.gz: a7d0a7583c9ab2b58b681ea9a98bde609ce1c416497453493396572124883c5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce644c04d72c80221459cae9687395bf8ef7e72616d941fde20ebc0cf54405966556db30a50babd779792012317c1e904f0dc491535de6a076d80742b58d57f6
|
7
|
+
data.tar.gz: 468e1d6118ba79e01c24eba45339e76090f566eddd2969bbb71edff51c02304db981cd54fa8c111420115b545d15d41239be59a05e74814ca2d6e3e1655a2da1
|
data/.rubocop.yml
CHANGED
data/exe/souls
CHANGED
data/lib/souls.rb
CHANGED
data/lib/souls/init.rb
CHANGED
@@ -623,15 +623,154 @@ module Souls
|
|
623
623
|
[file_path]
|
624
624
|
end
|
625
625
|
|
626
|
-
def
|
627
|
-
|
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.downcase}) { FactoryBot.create(:#{class_name.singularize.downcase}) }
|
633
|
+
|
634
|
+
let(:mutation) do
|
635
|
+
%(mutation {
|
636
|
+
create#{class_name.camelize}(input: {
|
637
|
+
EOS
|
638
|
+
end
|
628
639
|
end
|
629
640
|
|
630
|
-
|
631
|
-
|
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 user {\n id\n"
|
651
|
+
break
|
652
|
+
end
|
653
|
+
field = '["tag1", "tag2", "tag3"]' if line.include?("array: true")
|
654
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
655
|
+
field ||= get_test_type type
|
656
|
+
case name
|
657
|
+
when "created_at", "updated_at"
|
658
|
+
next
|
659
|
+
else
|
660
|
+
case type
|
661
|
+
when "string", "text"
|
662
|
+
new_line.write " #{name.camelize(:lower)}: \"\#{#{class_name.singularize}.#{name.underscore}}\"\n"
|
663
|
+
when "bigint", "integer", "float", "boolean"
|
664
|
+
new_line.write " #{name.camelize(:lower)}: \#{#{class_name.singularize}.#{name.underscore}}\n"
|
665
|
+
when "date", "datetime"
|
666
|
+
new_line.write " #{name.camelize(:lower)}: \#{Time.now}\n"
|
667
|
+
end
|
668
|
+
end
|
669
|
+
end
|
670
|
+
if table_check(line: line, class_name: class_name)
|
671
|
+
@on = true
|
672
|
+
end
|
673
|
+
end
|
674
|
+
end
|
675
|
+
end
|
676
|
+
end
|
677
|
+
|
678
|
+
def rspec_mutation_params_response class_name: "souls"
|
679
|
+
file_path = "./spec/mutations/#{class_name.pluralize}.rb"
|
680
|
+
path = "./db/schema.rb"
|
681
|
+
@on = false
|
682
|
+
File.open(file_path, "a") do |new_line|
|
683
|
+
File.open(path, "r") do |f|
|
684
|
+
f.each_line.with_index do |line, i|
|
685
|
+
if @on
|
686
|
+
if line.include?("end") || line.include?("t.index")
|
687
|
+
new_line.write <<-EOS
|
688
|
+
}
|
689
|
+
}
|
690
|
+
)
|
691
|
+
end
|
692
|
+
|
693
|
+
subject(:result) do
|
694
|
+
SoulsApiSchema.execute(mutation).as_json
|
695
|
+
end
|
696
|
+
|
697
|
+
it "return #{class_name.camelize} Data" do
|
698
|
+
a1 = result.dig("data", "create#{class_name.camelize}", "#{class_name.singularize}")
|
699
|
+
expect(a1).to include(
|
700
|
+
"id" => be_a(Integer),
|
701
|
+
EOS
|
702
|
+
break
|
703
|
+
end
|
704
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
705
|
+
case name
|
706
|
+
when "created_at", "updated_at"
|
707
|
+
next
|
708
|
+
else
|
709
|
+
new_line.write " #{name.camelize(:lower)}\n"
|
710
|
+
end
|
711
|
+
end
|
712
|
+
if table_check(line: line, class_name: class_name)
|
713
|
+
@on = true
|
714
|
+
end
|
715
|
+
end
|
716
|
+
end
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
def rspec_mutation_end class_name: "souls"
|
721
|
+
file_path = "./spec/mutations/#{class_name.pluralize}.rb"
|
722
|
+
path = "./db/schema.rb"
|
723
|
+
@on = false
|
724
|
+
File.open(file_path, "a") do |new_line|
|
725
|
+
File.open(path, "r") do |f|
|
726
|
+
f.each_line.with_index do |line, i|
|
727
|
+
if @on
|
728
|
+
if line.include?("end") || line.include?("t.index")
|
729
|
+
new_line.write <<-EOS
|
730
|
+
)
|
731
|
+
end
|
732
|
+
end
|
733
|
+
end
|
734
|
+
EOS
|
735
|
+
break
|
736
|
+
end
|
737
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
738
|
+
field ||= type_check type
|
739
|
+
array_true = line.include?("array: true")
|
740
|
+
case name
|
741
|
+
when "created_at", "updated_at"
|
742
|
+
next
|
743
|
+
else
|
744
|
+
case type
|
745
|
+
when "text"
|
746
|
+
if array_true
|
747
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_all(String),\n"
|
748
|
+
end
|
749
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
750
|
+
when "string", "bigint", "integer", "float", "boolean"
|
751
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
752
|
+
when "date", "datetime"
|
753
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(DateTime),\n"
|
754
|
+
end
|
755
|
+
end
|
756
|
+
end
|
757
|
+
if table_check(line: line, class_name: class_name)
|
758
|
+
@on = true
|
759
|
+
end
|
760
|
+
end
|
761
|
+
end
|
762
|
+
end
|
763
|
+
end
|
764
|
+
|
765
|
+
def rspec_mutation class_name: "souls"
|
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
|
632
771
|
end
|
633
772
|
|
634
|
-
def
|
773
|
+
def rspec_query class_name: "souls"
|
635
774
|
# if needed
|
636
775
|
end
|
637
776
|
|
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.10.
|
4
|
+
version: 0.10.7
|
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
|