souls 0.13.6 → 0.13.7
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/Gemfile.lock +1 -1
- data/exe/souls +8 -8
- data/lib/souls/init.rb +248 -181
- 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: 53da6d8b3f84df3136e5e557035f68d23aa4cb97eb42648d7219ad521a58ec93
|
4
|
+
data.tar.gz: c12200d5439b99d52d3beef650f1513e21a8709d503fe2b3641f507bac278b86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28d17def0684d6622fd13d4979bdb855fc8ef0f69a2e425fbf0380e79751a0e4119cc597380879a21289d78463e7960a770ac1d50ba17c0c43592e6c683fee1
|
7
|
+
data.tar.gz: 1ce61c0bd694cfe6401c339cea92e0fa34ff1a5b15f40fb040b3d550a08af164b984fbbb6eee2c907d924f9750e1ad8eee0bc043f19f61dbfe6e5cff0dc08c39
|
data/Gemfile.lock
CHANGED
data/exe/souls
CHANGED
@@ -3,7 +3,7 @@ require "souls"
|
|
3
3
|
|
4
4
|
begin
|
5
5
|
begin
|
6
|
-
require "./config/initializers/souls" unless ARGV[0] == "new" || ARGV[0] == "init"
|
6
|
+
require "./config/initializers/souls" unless ARGV[0] == "new" || ARGV[0] == "init" || ARGV[0] == "s"
|
7
7
|
rescue
|
8
8
|
Souls::Init.config_init
|
9
9
|
end
|
@@ -13,27 +13,27 @@ begin
|
|
13
13
|
puts "you need to specify your app name \n `souls new app_name`"
|
14
14
|
exit
|
15
15
|
end
|
16
|
-
puts "Which framework: \n 1. SOULS
|
16
|
+
puts "Which framework: \n 1. SOULS GraphQL API \n 2. SOULS GraphQL API gRPC compatible \n 3. SOULS gRPC Service \n 4. SOULS Media Web \n 5. SOULS Admin Web \n Enter Number: "
|
17
17
|
strain = STDIN.gets.chomp.to_i
|
18
18
|
(1..5).include?(strain) ? puts("Generating Souls.. \n") : raise(StandardError, "Choose Number 1..5")
|
19
19
|
Souls::Init.create_souls strain: strain, app_name: ARGV[1]
|
20
20
|
when "s", "server"
|
21
21
|
strain = Souls.configuration.strain
|
22
22
|
case strain
|
23
|
-
when "
|
24
|
-
system "
|
23
|
+
when "media", "admin"
|
24
|
+
system "yarn dev"
|
25
25
|
when "service"
|
26
26
|
system "bundle exec rake run_server"
|
27
27
|
else
|
28
|
-
system "
|
28
|
+
system "bundle exec puma -p 3000"
|
29
29
|
end
|
30
30
|
when "c", "console"
|
31
31
|
strain = Souls.configuration.strain
|
32
32
|
case strain
|
33
|
-
when "
|
34
|
-
system "bundle exec irb"
|
35
|
-
else
|
33
|
+
when "media", "admin"
|
36
34
|
system "yarn dev"
|
35
|
+
else
|
36
|
+
system "bundle exec irb"
|
37
37
|
end
|
38
38
|
when "i", "infra"
|
39
39
|
Souls.send ARGV[1]
|
data/lib/souls/init.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Souls
|
2
|
-
STRAINS = ["
|
2
|
+
STRAINS = ["graph", "api", "service", "media", "admin"]
|
3
3
|
module Init
|
4
4
|
class << self
|
5
5
|
def create_souls strain: 1, app_name: "souls"
|
@@ -723,67 +723,101 @@ module Souls
|
|
723
723
|
f.write <<~EOS
|
724
724
|
RSpec.describe \"#{class_name.camelize} Mutation テスト\" do
|
725
725
|
describe "#{class_name.camelize} データを登録する" do
|
726
|
-
|
727
|
-
|
728
|
-
let(:mutation) do
|
729
|
-
%(mutation {
|
730
|
-
create#{class_name.camelize}(input: {
|
726
|
+
get_global_key = proc {|class_name, id| Base64.encode64(\"\#{class_name}:\#{id}\")}
|
731
727
|
EOS
|
732
728
|
end
|
733
729
|
end
|
734
730
|
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
731
|
+
def rspec_mutation_after_head class_name: "souls"
|
732
|
+
file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
|
733
|
+
path = "./db/schema.rb"
|
734
|
+
@on = false
|
735
|
+
@user_exist = false
|
736
|
+
@relation_params = []
|
737
|
+
File.open(file_path, "a") do |new_line|
|
738
|
+
File.open(path, "r") do |f|
|
739
|
+
f.each_line.with_index do |line, i|
|
740
|
+
if @on
|
741
|
+
if line.include?("end") || line.include?("t.index")
|
742
|
+
new_line.write <<-EOS
|
743
|
+
let(:#{class_name}) { FactoryBot.attributes_for(:#{class_name}, #{@relation_params.join(", ")}) }
|
744
|
+
|
745
|
+
let(:mutation) do
|
746
|
+
%(mutation {
|
747
|
+
create#{class_name.camelize}(input: {
|
748
|
+
EOS
|
749
|
+
break
|
750
|
+
end
|
751
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
752
|
+
case name
|
753
|
+
when /$*_id\z/
|
754
|
+
relation_col = name.gsub("_id", "")
|
755
|
+
@relation_params << "#{name}: get_global_key.call(\"#{name.singularize.camelize.gsub("Id", "")}\", #{relation_col}.id)"
|
756
|
+
new_line.write " let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n"
|
757
|
+
end
|
758
|
+
end
|
759
|
+
if table_check(line: line, class_name: class_name)
|
760
|
+
@on = true
|
761
|
+
end
|
762
|
+
end
|
763
|
+
end
|
764
|
+
end
|
765
|
+
end
|
766
|
+
|
767
|
+
def rspec_mutation_params class_name: "souls"
|
768
|
+
file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
|
769
|
+
path = "./db/schema.rb"
|
770
|
+
@on = false
|
771
|
+
@user_exist = false
|
772
|
+
File.open(file_path, "a") do |new_line|
|
773
|
+
File.open(path, "r") do |f|
|
774
|
+
f.each_line.with_index do |line, i|
|
775
|
+
if @on
|
776
|
+
if line.include?("end") || line.include?("t.index")
|
777
|
+
new_line.write " }) {\n #{class_name.singularize.camelize(:lower)} {\n id\n"
|
778
|
+
break
|
779
|
+
end
|
780
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
781
|
+
array_true = line.include?("array: true")
|
782
|
+
case name
|
783
|
+
when "created_at", "updated_at"
|
784
|
+
next
|
785
|
+
when "user_id"
|
786
|
+
@user_exist = true
|
787
|
+
when /$*_id\z/
|
788
|
+
new_line.write " #{name.singularize.camelize(:lower)}: \"\#{#{class_name.singularize}[:#{name.singularize.underscore}]}\"\n"
|
789
|
+
else
|
790
|
+
case type
|
791
|
+
when "string", "text", "date", "datetime"
|
792
|
+
if array_true && name != "tag"
|
793
|
+
new_line.write " #{name.pluralize.camelize(:lower)}: \#{#{class_name.singularize}[:#{name.pluralize.underscore}]}\n"
|
794
|
+
else
|
795
|
+
new_line.write " #{name.singularize.camelize(:lower)}: \"\#{#{class_name.singularize}[:#{name.singularize.underscore}]}\"\n"
|
765
796
|
end
|
797
|
+
when "bigint", "integer", "float", "boolean"
|
798
|
+
new_line.write " #{name.singularize.camelize(:lower)}: \#{#{class_name.singularize}[:#{name.singularize.underscore}]}\n"
|
766
799
|
end
|
767
800
|
end
|
768
|
-
|
769
|
-
|
770
|
-
|
801
|
+
end
|
802
|
+
if table_check(line: line, class_name: class_name)
|
803
|
+
@on = true
|
771
804
|
end
|
772
805
|
end
|
773
806
|
end
|
774
807
|
end
|
808
|
+
end
|
775
809
|
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
810
|
+
def rspec_mutation_params_response class_name: "souls"
|
811
|
+
file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
|
812
|
+
path = "./db/schema.rb"
|
813
|
+
@on = false
|
814
|
+
File.open(file_path, "a") do |new_line|
|
815
|
+
File.open(path, "r") do |f|
|
816
|
+
f.each_line.with_index do |line, i|
|
817
|
+
if @on
|
818
|
+
if line.include?("end") || line.include?("t.index")
|
819
|
+
if @user_exist
|
820
|
+
new_line.write <<-EOS
|
787
821
|
}
|
788
822
|
}
|
789
823
|
}
|
@@ -801,9 +835,9 @@ module Souls
|
|
801
835
|
a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}")
|
802
836
|
expect(a1).to include(
|
803
837
|
"id" => be_a(String),
|
804
|
-
|
805
|
-
|
806
|
-
|
838
|
+
EOS
|
839
|
+
else
|
840
|
+
new_line.write <<-EOS
|
807
841
|
}
|
808
842
|
}
|
809
843
|
}
|
@@ -818,81 +852,82 @@ module Souls
|
|
818
852
|
a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}")
|
819
853
|
expect(a1).to include(
|
820
854
|
"id" => be_a(String),
|
821
|
-
|
822
|
-
end
|
823
|
-
break
|
855
|
+
EOS
|
824
856
|
end
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
857
|
+
break
|
858
|
+
end
|
859
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
860
|
+
array_true = line.include?("array: true")
|
861
|
+
case name
|
862
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
863
|
+
next
|
864
|
+
else
|
865
|
+
if array_true
|
866
|
+
new_line.write " #{name.pluralize.camelize(:lower)}\n"
|
830
867
|
else
|
831
|
-
|
832
|
-
new_line.write " #{name.pluralize.camelize(:lower)}\n"
|
833
|
-
else
|
834
|
-
new_line.write " #{name.singularize.camelize(:lower)}\n"
|
835
|
-
end
|
868
|
+
new_line.write " #{name.singularize.camelize(:lower)}\n"
|
836
869
|
end
|
837
870
|
end
|
838
|
-
|
839
|
-
|
840
|
-
|
871
|
+
end
|
872
|
+
if table_check(line: line, class_name: class_name)
|
873
|
+
@on = true
|
841
874
|
end
|
842
875
|
end
|
843
876
|
end
|
844
877
|
end
|
878
|
+
end
|
845
879
|
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
end
|
880
|
+
def rspec_mutation_end class_name: "souls"
|
881
|
+
file_path = "./spec/mutations/#{class_name.singularize}_spec.rb"
|
882
|
+
path = "./db/schema.rb"
|
883
|
+
@on = false
|
884
|
+
File.open(file_path, "a") do |new_line|
|
885
|
+
File.open(path, "r") do |f|
|
886
|
+
f.each_line.with_index do |line, i|
|
887
|
+
if @on
|
888
|
+
if line.include?("end") || line.include?("t.index")
|
889
|
+
new_line.write <<~EOS
|
890
|
+
)
|
858
891
|
end
|
859
892
|
end
|
860
|
-
EOS
|
861
|
-
break
|
862
|
-
end
|
863
|
-
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
864
|
-
field ||= type_check type
|
865
|
-
array_true = line.include?("array: true")
|
866
|
-
case name
|
867
|
-
when "user_id", "created_at", "updated_at"
|
868
|
-
next
|
869
|
-
else
|
870
|
-
case type
|
871
|
-
when "text", "date", "datetime"
|
872
|
-
if array_true
|
873
|
-
new_line.write " \"#{name.pluralize.camelize(:lower)}\" => be_all(String),\n"
|
874
|
-
else
|
875
|
-
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(String),\n"
|
876
893
|
end
|
877
|
-
|
878
|
-
|
879
|
-
when "string", "bigint", "integer", "float"
|
880
|
-
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
881
|
-
end
|
882
|
-
end
|
894
|
+
EOS
|
895
|
+
break
|
883
896
|
end
|
884
|
-
|
885
|
-
|
897
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
898
|
+
field ||= type_check type
|
899
|
+
array_true = line.include?("array: true")
|
900
|
+
case name
|
901
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
902
|
+
next
|
903
|
+
else
|
904
|
+
case type
|
905
|
+
when "text", "date", "datetime"
|
906
|
+
if array_true
|
907
|
+
new_line.write " \"#{name.pluralize.camelize(:lower)}\" => be_all(String),\n"
|
908
|
+
else
|
909
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(String),\n"
|
910
|
+
end
|
911
|
+
when "boolean"
|
912
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_in([true, false]),\n"
|
913
|
+
when "string", "bigint", "integer", "float"
|
914
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
915
|
+
end
|
886
916
|
end
|
887
917
|
end
|
918
|
+
if table_check(line: line, class_name: class_name)
|
919
|
+
@on = true
|
920
|
+
end
|
888
921
|
end
|
889
922
|
end
|
890
|
-
[file_path]
|
891
923
|
end
|
924
|
+
[file_path]
|
925
|
+
end
|
892
926
|
|
893
927
|
def rspec_mutation class_name: "souls"
|
894
928
|
singularized_class_name = class_name.singularize
|
895
929
|
rspec_mutation_head class_name: singularized_class_name
|
930
|
+
rspec_mutation_after_head class_name: singularized_class_name
|
896
931
|
rspec_mutation_params class_name: singularized_class_name
|
897
932
|
rspec_mutation_params_response class_name: singularized_class_name
|
898
933
|
rspec_mutation_end class_name: singularized_class_name
|
@@ -904,109 +939,141 @@ module Souls
|
|
904
939
|
f.write <<~EOS
|
905
940
|
RSpec.describe \"#{class_name.camelize} Query テスト\" do
|
906
941
|
describe "#{class_name.camelize} データを取得する" do
|
907
|
-
let!(:#{class_name.singularize.underscore}) { FactoryBot.create(:#{class_name.singularize.underscore}) }
|
908
|
-
|
909
|
-
let(:query) do
|
910
|
-
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
911
|
-
%(query {
|
912
|
-
#{class_name.singularize.camelize(:lower)}(id: \\"\#{data_id}\\") {
|
913
|
-
id
|
914
942
|
EOS
|
915
943
|
end
|
916
944
|
end
|
917
945
|
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
946
|
+
def rspec_query_after_head class_name: "souls"
|
947
|
+
file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
|
948
|
+
path = "./db/schema.rb"
|
949
|
+
@on = false
|
950
|
+
@user_exist = false
|
951
|
+
@relation_params = []
|
952
|
+
File.open(file_path, "a") do |new_line|
|
953
|
+
File.open(path, "r") do |f|
|
954
|
+
f.each_line.with_index do |line, i|
|
955
|
+
if @on
|
956
|
+
if line.include?("end") || line.include?("t.index")
|
957
|
+
new_line.write <<-EOS
|
958
|
+
let(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(", ")}) }
|
959
|
+
|
960
|
+
let(:query) do
|
961
|
+
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
962
|
+
%(query {
|
963
|
+
#{class_name.singularize.camelize(:lower)}(id: \\"\#{data_id}\\") {
|
964
|
+
id
|
965
|
+
EOS
|
966
|
+
break
|
967
|
+
end
|
968
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
969
|
+
case name
|
970
|
+
when /$*_id\z/
|
971
|
+
relation_col = name.gsub("_id", "")
|
972
|
+
@relation_params << "#{name}: #{relation_col}.id"
|
973
|
+
new_line.write " let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n"
|
974
|
+
end
|
975
|
+
end
|
976
|
+
if table_check(line: line, class_name: class_name)
|
977
|
+
@on = true
|
978
|
+
end
|
979
|
+
end
|
980
|
+
end
|
981
|
+
end
|
982
|
+
end
|
983
|
+
|
984
|
+
def rspec_query_params class_name: "souls"
|
985
|
+
file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
|
986
|
+
path = "./db/schema.rb"
|
987
|
+
@on = false
|
988
|
+
File.open(file_path, "a") do |new_line|
|
989
|
+
File.open(path, "r") do |f|
|
990
|
+
f.each_line.with_index do |line, i|
|
991
|
+
if @on
|
992
|
+
if line.include?("end") || line.include?("t.index")
|
993
|
+
new_line.write <<-EOS
|
929
994
|
}
|
930
|
-
|
931
|
-
|
995
|
+
}
|
996
|
+
)
|
997
|
+
end
|
932
998
|
|
933
|
-
|
934
|
-
|
935
|
-
|
999
|
+
subject(:result) do
|
1000
|
+
SoulsApiSchema.execute(query).as_json
|
1001
|
+
end
|
936
1002
|
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
end
|
944
|
-
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
945
|
-
case name
|
946
|
-
when "user_id", "created_at", "updated_at"
|
947
|
-
next
|
948
|
-
else
|
949
|
-
new_line.write " #{name.singularize.camelize(:lower)}\n"
|
950
|
-
end
|
1003
|
+
it "return #{class_name.camelize} Data" do
|
1004
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}")
|
1005
|
+
expect(a1).to include(
|
1006
|
+
"id" => be_a(String),
|
1007
|
+
EOS
|
1008
|
+
break
|
951
1009
|
end
|
952
|
-
|
953
|
-
|
1010
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
1011
|
+
case name
|
1012
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
1013
|
+
next
|
1014
|
+
else
|
1015
|
+
new_line.write " #{name.singularize.camelize(:lower)}\n"
|
954
1016
|
end
|
955
1017
|
end
|
1018
|
+
if table_check(line: line, class_name: class_name)
|
1019
|
+
@on = true
|
1020
|
+
end
|
956
1021
|
end
|
957
1022
|
end
|
958
1023
|
end
|
1024
|
+
end
|
959
1025
|
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
1026
|
+
def rspec_query_end class_name: "souls"
|
1027
|
+
file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
|
1028
|
+
path = "./db/schema.rb"
|
1029
|
+
@on = false
|
1030
|
+
File.open(file_path, "a") do |new_line|
|
1031
|
+
File.open(path, "r") do |f|
|
1032
|
+
f.each_line.with_index do |line, i|
|
1033
|
+
if @on
|
1034
|
+
if line.include?("end") || line.include?("t.index")
|
1035
|
+
new_line.write <<-EOS
|
970
1036
|
)
|
971
1037
|
end
|
972
1038
|
end
|
973
1039
|
end
|
974
|
-
|
975
|
-
|
976
|
-
end
|
977
|
-
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
978
|
-
field ||= type_check type
|
979
|
-
array_true = line.include?("array: true")
|
980
|
-
case name
|
981
|
-
when "user_id", "created_at", "updated_at"
|
982
|
-
next
|
983
|
-
else
|
984
|
-
case type
|
985
|
-
when "text", "date", "datetime"
|
986
|
-
if array_true
|
987
|
-
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_all(String),\n"
|
988
|
-
else
|
989
|
-
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(String),\n"
|
990
|
-
end
|
991
|
-
when "boolean"
|
992
|
-
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_in([true, false]),\n"
|
993
|
-
when "string", "bigint", "integer", "float"
|
994
|
-
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
995
|
-
end
|
996
|
-
end
|
1040
|
+
EOS
|
1041
|
+
break
|
997
1042
|
end
|
998
|
-
|
999
|
-
|
1043
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
1044
|
+
field ||= type_check type
|
1045
|
+
array_true = line.include?("array: true")
|
1046
|
+
case name
|
1047
|
+
when "user_id", "created_at", "updated_at", /$*_id\z/
|
1048
|
+
next
|
1049
|
+
else
|
1050
|
+
case type
|
1051
|
+
when "text", "date", "datetime"
|
1052
|
+
if array_true
|
1053
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_all(String),\n"
|
1054
|
+
else
|
1055
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(String),\n"
|
1056
|
+
end
|
1057
|
+
when "boolean"
|
1058
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_in([true, false]),\n"
|
1059
|
+
when "string", "bigint", "integer", "float"
|
1060
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
1061
|
+
end
|
1000
1062
|
end
|
1001
1063
|
end
|
1064
|
+
if table_check(line: line, class_name: class_name)
|
1065
|
+
@on = true
|
1066
|
+
end
|
1002
1067
|
end
|
1003
1068
|
end
|
1004
|
-
[file_path]
|
1005
1069
|
end
|
1070
|
+
[file_path]
|
1071
|
+
end
|
1006
1072
|
|
1007
1073
|
def rspec_query class_name: "souls"
|
1008
1074
|
singularized_class_name = class_name.singularize
|
1009
1075
|
rspec_query_head class_name: singularized_class_name
|
1076
|
+
rspec_query_after_head class_name: singularized_class_name
|
1010
1077
|
rspec_query_params class_name: singularized_class_name
|
1011
1078
|
rspec_query_end class_name: singularized_class_name
|
1012
1079
|
end
|
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.13.
|
4
|
+
version: 0.13.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-
|
13
|
+
date: 2021-02-02 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 GraphQL Based Web Application Framework for Microservices on Multi
|