souls 0.10.5 → 0.11.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: 2b156e6723bbffc13d1cc2902a86ac4cbcd5ba627ba4ad3b14dc3a1d5385d5dc
4
- data.tar.gz: 8d6378c58d3c8af8f157da88cdc47ba625aed8dac14703fa6ba14413fe2bd4f7
3
+ metadata.gz: 0fb828b91b3c8afa1c4b8043c0d4d4a75a5b0b20b534239f88ef34ffeaab5e7f
4
+ data.tar.gz: 9c66a20de7f68b05ce60e9f6418a669da6078b32f82882cf3a8ea2d068f59251
5
5
  SHA512:
6
- metadata.gz: 6d2ffbf97336cba78bd194d7bcfc3cf7a5e796fa225a83e960b00ccd11efe041e5e5694c71980886823ba4ccb7f3cf61fa027d5ac3efad03341ab83e627f794d
7
- data.tar.gz: eb88107ec6ffdae5a6e771cf6d431ae8eea6177bb6fafc2316d408a31ca076169948dd13bc428f921ec921d1fdf89025e98b1f85a044239c2387295ce2b8a341
6
+ metadata.gz: ad40438d10f79ae913e8199728fea477ea816b41cf26139124cb9daf9eb6f2a94ad983a34b29017847a32c0309eda859759b173a79fb3fde4c7af4176a6112d5
7
+ data.tar.gz: b76f74ebe3a6dc02a95185a52e24c9e07ffb116cf8f6865d920a5188078340c8fb48fda3d6c7bfc00e6d6f71e6f66b988a05e867b565c8743556fac02f5e25e9
@@ -205,4 +205,6 @@ Layout/HeredocIndentation:
205
205
  Exclude:
206
206
  - "lib/souls/init.rb"
207
207
  Style/RaiseArgs:
208
- Enabled: false
208
+ Enabled: false
209
+ Metrics/BlockNesting:
210
+ Enable: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.10.4)
4
+ souls (0.10.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/exe/souls CHANGED
@@ -20,7 +20,7 @@ begin
20
20
  when "s", "server"
21
21
  strain = Souls.configuration.strain
22
22
  case strain
23
- when "api"
23
+ when "api", "graph"
24
24
  system "bundle exec puma -p 3000"
25
25
  when "service"
26
26
  system "bundle exec rake run_server"
@@ -30,9 +30,7 @@ begin
30
30
  when "c", "console"
31
31
  strain = Souls.configuration.strain
32
32
  case strain
33
- when "api"
34
- system "bundle exec irb"
35
- when "service"
33
+ when "api", "graph", "service"
36
34
  system "bundle exec irb"
37
35
  else
38
36
  system "yarn dev"
@@ -48,7 +46,7 @@ begin
48
46
  when "g", "generate"
49
47
  case ARGV[1]
50
48
  when "test"
51
- Souls::Init.get_tables
49
+ Souls::Init.rspec_mutation class_name: "user"
52
50
  when "model"
53
51
  Souls::Init.model class_name: ARGV[2]
54
52
  when "mutation"
@@ -74,10 +72,14 @@ begin
74
72
  when "rspec_type"
75
73
  Souls::Init.rspec_type class_name: ARGV[2]
76
74
  else
75
+ "SOULs!"
77
76
  end
78
77
  when "t", "test"
79
78
  `rubocop`
80
79
  `bundle exec rspec`
80
+ when "run"
81
+ `docker build . -t souls:latest`
82
+ `docker run --rm -p 3000:3000 souls:latest`
81
83
  when "deploy"
82
84
  project_id = Souls.configuration.project_id
83
85
  `gcloud builds submit --config=cloudbuild.yml --project #{project_id}`
@@ -378,7 +378,7 @@ module Souls
378
378
  -e POSTGRES_PASSWORD=postgres \
379
379
  -e POSTGRES_DB=souls_test \
380
380
  postgres:13-alpine`
381
- `docker ps`
381
+ puts `docker ps`
382
382
  end
383
383
 
384
384
  def run_awake
@@ -623,15 +623,153 @@ module Souls
623
623
  [file_path]
624
624
  end
625
625
 
626
- def rspec_mutation class_name: "souls"
627
- # if needed
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
- def rspec_query class_name: "souls"
631
- # if needed
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
+ 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
+ end
763
+
764
+ def rspec_mutation class_name: "souls"
765
+ singularized_class_name = class_name.singularize
766
+ rspec_mutation_head class_name: singularized_class_name
767
+ rspec_mutation_params class_name: singularized_class_name
768
+ rspec_mutation_params_response class_name: singularized_class_name
769
+ rspec_mutation_end class_name: singularized_class_name
632
770
  end
633
771
 
634
- def rspec_type class_name: "souls"
772
+ def rspec_query class_name: "souls"
635
773
  # if needed
636
774
  end
637
775
 
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.10.5"
2
+ VERSION = "0.11.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.10.5
4
+ version: 0.11.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-23 00:00:00.000000000 Z
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.4
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