souls 0.11.5 → 0.12.0

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: 4f1681486df5b3189aacfdc97ea729ec7e1e4dce2830ee5c48cf9cb197015584
4
- data.tar.gz: 25bdc7b30c83f34b729cf5085709faf13ae502c78d74fd3dfc6b121995695e4e
3
+ metadata.gz: bb1a22840a3d3bc0a968a9cddf60b195062d6265e0fc569bf67f138b4d27c116
4
+ data.tar.gz: 59f03a6f0e48e4a618492b09daf7b03d9d577d7f65f756bc0f648a0261f8b10e
5
5
  SHA512:
6
- metadata.gz: 3c43772368fd98a3ba0b37865bf49093f723c7be65a2e09e5dcaaa66643ebcfd5b4717766f3ee4cab61f6683d44041179ffb019a6bb2f42e47833685f6e0dad0
7
- data.tar.gz: 68f587a562956aed0694c568af0971c7c6661c1d5ea602134cf9a4ee230db1352a322a8864a2a712de12400e7fc313f31cbeb5131becbb2d0c9e92f88458a21c
6
+ metadata.gz: a13f051450e4b2eb8ebc8676db2033d5e87580ae0d2d24ffede18f8df548020f40fa60c78645fba0f603cc35418399b810f9a406a9ea5ed7a3e20d58f8cf252f
7
+ data.tar.gz: ae460ff7b24ea3f22f6c67519a8378136f1770a6ee037c1effedaa9f9f809fdc52771df9009a6a8b286f8817154b07fc8f00f7105553cba93c45fcbddf85ce04
@@ -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.2)
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]
@@ -780,15 +785,16 @@ end
780
785
  let!(:#{class_name.singularize.underscore}) { FactoryBot.create(:#{class_name.singularize.underscore}) }
781
786
 
782
787
  let(:query) do
788
+ data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
783
789
  %(query {
784
- #{class_name.singularize.underscore}(id: \#{Base64.encode64("#{class_name.camelize}:\#{#{class_name.underscore}.id}")}) {
790
+ #{class_name.singularize.underscore}(id: \\"\#{data_id}\\") {
785
791
  id
786
792
  EOS
787
793
  end
788
794
  end
789
795
 
790
796
  def rspec_query_params class_name: "souls"
791
- file_path = "./spec/queries/#{class_name.pluralize}.rb"
797
+ file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
792
798
  path = "./db/schema.rb"
793
799
  @on = false
794
800
  File.open(file_path, "a") do |new_line|
@@ -830,7 +836,7 @@ end
830
836
  end
831
837
 
832
838
  def rspec_query_end class_name: "souls"
833
- file_path = "./spec/queries/#{class_name.pluralize}.rb"
839
+ file_path = "./spec/queries/#{class_name.singularize}_spec.rb"
834
840
  path = "./db/schema.rb"
835
841
  @on = false
836
842
  File.open(file_path, "a") do |new_line|
@@ -941,6 +947,43 @@ end
941
947
  ]
942
948
  end
943
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
+
944
987
  def migrate_all
945
988
  puts "◆◆◆ Let's Auto Generate CRUD API ◆◆◆\n"
946
989
  paths = get_tables.map do |class_name|
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.11.5"
2
+ VERSION = "0.12.0"
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.5
4
+ version: 0.12.0
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.