souls 0.10.2 → 0.10.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/.rubocop.yml +3 -1
- data/Gemfile.lock +1 -1
- data/exe/souls +7 -5
- data/lib/souls.rb +1 -1
- data/lib/souls/init.rb +148 -10
- data/lib/souls/version.rb +1 -1
- metadata +2 -3
- data/v0.0.8.tar.gz +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c64bef1b432a5f2480396310ec48cd750fc14e8a8f967e93562be1a80427b8f
|
|
4
|
+
data.tar.gz: a7d0a7583c9ab2b58b681ea9a98bde609ce1c416497453493396572124883c5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce644c04d72c80221459cae9687395bf8ef7e72616d941fde20ebc0cf54405966556db30a50babd779792012317c1e904f0dc491535de6a076d80742b58d57f6
|
|
7
|
+
data.tar.gz: 468e1d6118ba79e01c24eba45339e76090f566eddd2969bbb71edff51c02304db981cd54fa8c111420115b545d15d41239be59a05e74814ca2d6e3e1655a2da1
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
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.
|
|
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}`
|
data/lib/souls.rb
CHANGED
data/lib/souls/init.rb
CHANGED
|
@@ -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..
|
|
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,154 @@ module Souls
|
|
|
624
623
|
[file_path]
|
|
625
624
|
end
|
|
626
625
|
|
|
627
|
-
def
|
|
628
|
-
|
|
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
|
-
|
|
632
|
-
|
|
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
|
+
end
|
|
692
|
+
|
|
693
|
+
subject(:result) do
|
|
694
|
+
SoulsApiSchema.execute(mutation).as_json
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
it "return #{class_name.camelize} Data" do
|
|
698
|
+
a1 = result.dig("data", "create#{class_name.camelize}", "#{class_name.singularize}")
|
|
699
|
+
expect(a1).to include(
|
|
700
|
+
"id" => be_a(Integer),
|
|
701
|
+
EOS
|
|
702
|
+
break
|
|
703
|
+
end
|
|
704
|
+
_, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
705
|
+
case name
|
|
706
|
+
when "created_at", "updated_at"
|
|
707
|
+
next
|
|
708
|
+
else
|
|
709
|
+
new_line.write " #{name.camelize(:lower)}\n"
|
|
710
|
+
end
|
|
711
|
+
end
|
|
712
|
+
if table_check(line: line, class_name: class_name)
|
|
713
|
+
@on = true
|
|
714
|
+
end
|
|
715
|
+
end
|
|
716
|
+
end
|
|
717
|
+
end
|
|
718
|
+
end
|
|
719
|
+
|
|
720
|
+
def rspec_mutation_end class_name: "souls"
|
|
721
|
+
file_path = "./spec/mutations/#{class_name.pluralize}.rb"
|
|
722
|
+
path = "./db/schema.rb"
|
|
723
|
+
@on = false
|
|
724
|
+
File.open(file_path, "a") do |new_line|
|
|
725
|
+
File.open(path, "r") do |f|
|
|
726
|
+
f.each_line.with_index do |line, i|
|
|
727
|
+
if @on
|
|
728
|
+
if line.include?("end") || line.include?("t.index")
|
|
729
|
+
new_line.write <<-EOS
|
|
730
|
+
)
|
|
731
|
+
end
|
|
732
|
+
end
|
|
733
|
+
end
|
|
734
|
+
EOS
|
|
735
|
+
break
|
|
736
|
+
end
|
|
737
|
+
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
|
738
|
+
field ||= type_check type
|
|
739
|
+
array_true = line.include?("array: true")
|
|
740
|
+
case name
|
|
741
|
+
when "created_at", "updated_at"
|
|
742
|
+
next
|
|
743
|
+
else
|
|
744
|
+
case type
|
|
745
|
+
when "text"
|
|
746
|
+
if array_true
|
|
747
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_all(String),\n"
|
|
748
|
+
end
|
|
749
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
|
750
|
+
when "string", "bigint", "integer", "float", "boolean"
|
|
751
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n"
|
|
752
|
+
when "date", "datetime"
|
|
753
|
+
new_line.write " \"#{name.singularize.camelize(:lower)}\" => be_a(DateTime),\n"
|
|
754
|
+
end
|
|
755
|
+
end
|
|
756
|
+
end
|
|
757
|
+
if table_check(line: line, class_name: class_name)
|
|
758
|
+
@on = true
|
|
759
|
+
end
|
|
760
|
+
end
|
|
761
|
+
end
|
|
762
|
+
end
|
|
763
|
+
end
|
|
764
|
+
|
|
765
|
+
def rspec_mutation class_name: "souls"
|
|
766
|
+
singularized_class_name = class_name.singularize
|
|
767
|
+
rspec_mutation_head class_name: singularized_class_name
|
|
768
|
+
rspec_mutation_params class_name: singularized_class_name
|
|
769
|
+
rspec_mutation_params_response class_name: singularized_class_name
|
|
770
|
+
rspec_mutation_end class_name: singularized_class_name
|
|
633
771
|
end
|
|
634
772
|
|
|
635
|
-
def
|
|
773
|
+
def rspec_query class_name: "souls"
|
|
636
774
|
# if needed
|
|
637
775
|
end
|
|
638
776
|
|
|
@@ -745,11 +883,11 @@ module Souls
|
|
|
745
883
|
path[:add_query_type].each { |line| puts line }
|
|
746
884
|
end
|
|
747
885
|
end
|
|
748
|
-
puts "\n
|
|
886
|
+
puts "\n ## Connection Type\n\n"
|
|
749
887
|
get_tables.each do |class_name|
|
|
750
888
|
puts " def #{class_name.pluralize}"
|
|
751
|
-
puts " #{class_name.camelize}.all.order(id: :desc)"
|
|
752
|
-
puts " end\n"
|
|
889
|
+
puts " #{class_name.singularize.camelize}.all.order(id: :desc)"
|
|
890
|
+
puts " end\n\n"
|
|
753
891
|
end
|
|
754
892
|
puts "\n#############################################################\n"
|
|
755
893
|
puts "# #\n"
|
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.10.
|
|
4
|
+
version: 0.10.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-01-
|
|
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
|
data/v0.0.8.tar.gz
DELETED
|
Binary file
|