souls 0.11.7 → 0.12.2

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: e60ce17f345ea901f1b3ce59ce36b8533762f329fcf859545b107a7ce7df1ecf
4
- data.tar.gz: ba3d733e4af9b79bcc64495827b6efaa9b8d69d2d1fe43b7b0081213106ae101
3
+ metadata.gz: a68a392b1084b1927f09f62b7703ee031adf3d9fb1990a0812a4368db8198a1d
4
+ data.tar.gz: 6cc29676ad348abe5f042ae734f531817c1aa05831d0ba27269705a7e70dfb29
5
5
  SHA512:
6
- metadata.gz: 621ac245d18736188d24620ebf180e613fe0d5e847b521e81a6bb336c7178296121bdc3d97f9d1b0785a1755a383a9580e6dd6e6e6c1174896692e18a0f27edc
7
- data.tar.gz: f36031c26c7b2efb98666003a06a59ab5d4473730ff8faca182297eec3405d321bacee0c348d6d1667567665a20117ae27aa66b2814518507cd22e88f9ba6a16
6
+ metadata.gz: e6ab6bd33f2827c75a1e567eec919cfed5624d626b95c74c8e1338f0782273f58b9bcf2e76a5f678a226ee984f17ad5f8936217986f982b106555c18d7afaf7f
7
+ data.tar.gz: a8ad5c04c3c9ace73ccd2209f77df11a832fc636948ccc988d8b356d9f78808ed1ccc85ccd3707311a63e71b3c86882aad046bba80aca1f0796c9acbfcfa26b6
@@ -207,4 +207,4 @@ Layout/HeredocIndentation:
207
207
  Style/RaiseArgs:
208
208
  Enabled: false
209
209
  Metrics/BlockNesting:
210
- Enable: false
210
+ Enabled: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.11.6)
4
+ souls (0.11.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/exe/souls CHANGED
@@ -46,7 +46,7 @@ begin
46
46
  when "g", "generate"
47
47
  case ARGV[1]
48
48
  when "test"
49
- Souls::Init.rspec_query class_name: "user"
49
+ Souls::Init.single_migrate class_name: "user"
50
50
  when "model"
51
51
  Souls::Init.model class_name: ARGV[2]
52
52
  when "mutation"
@@ -56,7 +56,7 @@ begin
56
56
  when "type"
57
57
  Souls::Init.type class_name: ARGV[2]
58
58
  when "migrate"
59
- Souls::Init.migrate class_name: ARGV[2]
59
+ Souls::Init.single_migrate class_name: ARGV[2]
60
60
  when "migrate_all"
61
61
  Souls::Init.migrate_all
62
62
  when "migration"
@@ -582,7 +582,12 @@ module Souls
582
582
  field = '["tag1", "tag2", "tag3"]' if line.include?("array: true")
583
583
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
584
584
  field ||= get_test_type type
585
- new_line.write " #{name} { #{field} }\n"
585
+ if type == "bigint" && name.include?("_id")
586
+ id_name = name.gsub("_id", "")
587
+ new_line.write " association :#{id_name}, factory: :#{id_name}\n"
588
+ else
589
+ new_line.write " #{name} { #{field} }\n"
590
+ end
586
591
  end
587
592
  if table_check(line: line, class_name: class_name)
588
593
  @on = true
@@ -648,7 +653,7 @@ module Souls
648
653
  f.each_line.with_index do |line, i|
649
654
  if @on
650
655
  if line.include?("end") || line.include?("t.index")
651
- new_line.write " }) {\n #{class_name.singularize.camelize} {\n id\n"
656
+ new_line.write " }) {\n #{class_name.singularize.camelize(:lower)} {\n id\n"
652
657
  break
653
658
  end
654
659
  type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
@@ -695,7 +700,7 @@ module Souls
695
700
  end
696
701
 
697
702
  it "return #{class_name.camelize} Data" do
698
- a1 = result.dig("data", "create#{class_name.camelize}", "#{class_name.singularize}")
703
+ a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}")
699
704
  expect(a1).to include(
700
705
  "id" => be_a(String),
701
706
  EOS
@@ -780,9 +785,9 @@ end
780
785
  let!(:#{class_name.singularize.underscore}) { FactoryBot.create(:#{class_name.singularize.underscore}) }
781
786
 
782
787
  let(:query) do
783
- data_id = Base64.encode64("User:\#{user.id}")
788
+ data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
784
789
  %(query {
785
- #{class_name.singularize.underscore}(id: \\"\#{data_id}\\") {
790
+ #{class_name.singularize.camelize}(id: \\"\#{data_id}\\") {
786
791
  id
787
792
  EOS
788
793
  end
@@ -808,7 +813,7 @@ end
808
813
  end
809
814
 
810
815
  it "return #{class_name.camelize} Data" do
811
- a1 = result.dig("data", "#{class_name.singularize.underscore}")
816
+ a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}")
812
817
  expect(a1).to include(
813
818
  "id" => be_a(String),
814
819
  EOS
@@ -942,6 +947,43 @@ end
942
947
  ]
943
948
  end
944
949
 
950
+ def single_migrate class_name: "user"
951
+ puts "◆◆◆ Let's Auto Generate CRUD API ◆◆◆\n"
952
+ result = migrate class_name: class_name
953
+ puts result[0][:model]
954
+ puts result[0][:type]
955
+ puts result[0][:rspec_factory]
956
+ puts result[0][:rspec_model]
957
+ puts result[0][:rspec_mutation]
958
+ puts result[0][:rspec_query]
959
+ puts result[0][:query]
960
+ puts result[0][:mutation]
961
+
962
+ puts "\nAll files created from ./db/schema.rb"
963
+ puts "\n\n"
964
+ puts "##########################################################\n"
965
+ puts "# #\n"
966
+ puts "# Add These Lines at ./app/graphql/types/query_type.rb #\n"
967
+ puts "# #\n"
968
+ puts "##########################################################\n\n\n"
969
+ result[0][:add_query_type].each do |path|
970
+ puts path
971
+ end
972
+ puts "\n ## Connection Type\n\n"
973
+ puts " def #{class_name.pluralize}"
974
+ puts " #{class_name.singularize.camelize}.all.order(id: :desc)"
975
+ puts " end\n\n\n"
976
+
977
+ puts "#############################################################\n"
978
+ puts "# #\n"
979
+ puts "# Add These Lines at ./app/graphql/types/mutation_type.rb #\n"
980
+ puts "# #\n"
981
+ puts "#############################################################\n\n\n"
982
+ result[0][:add_mutation_type].each do |path|
983
+ puts path
984
+ end
985
+ end
986
+
945
987
  def migrate_all
946
988
  puts "◆◆◆ Let's Auto Generate CRUD API ◆◆◆\n"
947
989
  paths = get_tables.map do |class_name|
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.11.7"
2
+ VERSION = "0.12.2"
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.7
4
+ version: 0.12.2
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-26 00:00:00.000000000 Z
13
+ date: 2021-01-28 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.