souls 0.10.3 → 0.10.8

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: fe9369434a6abecbc1cb289ea7aac653a0e3b91db733b3a36db61315d1d74ad2
4
- data.tar.gz: 7e87da0f68519dc5b1c1d275a252386162aba25357a53c80e045603ec99363fd
3
+ metadata.gz: 67c50236d6c17bc68456b3cd06c8b6a5421a52b0927f76eaa6660d4a38179343
4
+ data.tar.gz: f9f2255f2d73399248982c7bf8ef58232cfa5ce29e774c62cf4f94277f7c4ba2
5
5
  SHA512:
6
- metadata.gz: ce2e507855c02c4035afd03626d49a294f65d70ee67f6f789e89e77dc2af839ab407a5ec4e10971b7047305551503e4bf7aca56a1fe4aed8b03709542ab48cd7
7
- data.tar.gz: edbb59b6dec323d14247ff441a7e4bf4ad4aba340f5a2ab30c1ddf29f24ed38833edc5d1625747e8baeadc420e084a629953c610c83396a515438b9d13c44f65
6
+ metadata.gz: 4043bdc3548ab60b826e5c32f1a9c1b88997c3d574796c2caaa3ddad1a319cfd7fc569d9800c0f7bae4c0c1f2a69317720530d7b8f2fea8bc9301d5023495931
7
+ data.tar.gz: 0f64ce389e8d66bcc4a80172104b9a59319e0eb4a62f4905dacb87ccb6f7b89bcbe14e2a55fe7769d15b3c4b2815b7e9bd4747859a5730e8e95273501a88c901
@@ -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.2)
4
+ souls (0.10.4)
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
@@ -3,7 +3,7 @@ module Souls
3
3
  module Init
4
4
  class << self
5
5
  def create_souls strain: 1, app_name: "souls"
6
- config_needed = (1..2)
6
+ config_needed = (1..3)
7
7
  project = {}
8
8
  project[:strain] = STRAINS[strain.to_i - 1]
9
9
  begin
@@ -49,7 +49,6 @@ module Souls
49
49
  end
50
50
 
51
51
  def initial_config_init app_name: "souls", project: {}
52
- puts "Generating souls conf..."
53
52
  `touch "#{app_name}/config/initializers/souls.rb"`
54
53
  file_path = "#{app_name}/config/initializers/souls.rb"
55
54
  File.open(file_path, "w") do |f|
@@ -624,15 +623,155 @@ module Souls
624
623
  [file_path]
625
624
  end
626
625
 
627
- def rspec_mutation class_name: "souls"
628
- # 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
629
639
  end
630
640
 
631
- def rspec_query class_name: "souls"
632
- # 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
+ 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
+ )
692
+ end
693
+
694
+ subject(:result) do
695
+ SoulsApiSchema.execute(mutation).as_json
696
+ end
697
+
698
+ it "return #{class_name.camelize} Data" do
699
+ a1 = result.dig("data", "create#{class_name.camelize}", "#{class_name.singularize}")
700
+ expect(a1).to include(
701
+ "id" => be_a(String),
702
+ EOS
703
+ break
704
+ end
705
+ _, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
706
+ case name
707
+ when "created_at", "updated_at"
708
+ next
709
+ else
710
+ new_line.write " #{name.camelize(:lower)}\n"
711
+ end
712
+ end
713
+ if table_check(line: line, class_name: class_name)
714
+ @on = true
715
+ end
716
+ end
717
+ end
718
+ end
719
+ end
720
+
721
+ def rspec_mutation_end class_name: "souls"
722
+ file_path = "./spec/mutations/#{class_name.pluralize}.rb"
723
+ path = "./db/schema.rb"
724
+ @on = false
725
+ File.open(file_path, "a") do |new_line|
726
+ File.open(path, "r") do |f|
727
+ f.each_line.with_index do |line, i|
728
+ if @on
729
+ if line.include?("end") || line.include?("t.index")
730
+ new_line.write <<-EOS
731
+ )
732
+ end
733
+ end
734
+ end
735
+ EOS
736
+ break
737
+ end
738
+ type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
739
+ field ||= type_check type
740
+ array_true = line.include?("array: true")
741
+ case name
742
+ when "created_at", "updated_at"
743
+ next
744
+ else
745
+ case type
746
+ when "text"
747
+ if array_true
748
+ new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_all(String),\n"
749
+ end
750
+ new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
751
+ when "string", "bigint", "integer", "float", "boolean"
752
+ new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
753
+ when "date", "datetime"
754
+ new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(DateTime),\n"
755
+ end
756
+ end
757
+ end
758
+ if table_check(line: line, class_name: class_name)
759
+ @on = true
760
+ end
761
+ end
762
+ end
763
+ end
764
+ end
765
+
766
+ def rspec_mutation class_name: "souls"
767
+ singularized_class_name = class_name.singularize
768
+ rspec_mutation_head class_name: singularized_class_name
769
+ rspec_mutation_params class_name: singularized_class_name
770
+ rspec_mutation_params_response class_name: singularized_class_name
771
+ rspec_mutation_end class_name: singularized_class_name
633
772
  end
634
773
 
635
- def rspec_type class_name: "souls"
774
+ def rspec_query class_name: "souls"
636
775
  # if needed
637
776
  end
638
777
 
@@ -748,7 +887,7 @@ module Souls
748
887
  puts "\n ## Connection Type\n\n"
749
888
  get_tables.each do |class_name|
750
889
  puts " def #{class_name.pluralize}"
751
- puts " #{class_name.camelize}.all.order(id: :desc)"
890
+ puts " #{class_name.singularize.camelize}.all.order(id: :desc)"
752
891
  puts " end\n\n"
753
892
  end
754
893
  puts "\n#############################################################\n"
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.10.3"
2
+ VERSION = "0.10.8"
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.3
4
+ version: 0.10.8
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-22 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.
@@ -47,7 +47,6 @@ files:
47
47
  - lib/souls/version.rb
48
48
  - rbs/init.rbs
49
49
  - souls.gemspec
50
- - v0.0.8.tar.gz
51
50
  homepage: https://github.com/elsoul/souls
52
51
  licenses:
53
52
  - Apache-2.0
Binary file