souls 0.10.4 → 0.10.9
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 +146 -7
- 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: cb50933cf5e29db7883851f08b8e88ed44e9b0de3a30d3a8faf56db911f79437
|
|
4
|
+
data.tar.gz: a757f56a92f4740bd55825f36fc99fcd6ff868d1bc3f70b951cca84be6ea55a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 877562b163d9b8c360942990c37a0ff717b5545b2c3cc7381ac829ece20145daf65ab9c33ac420c5f6b4059ca81f36091b1286be0bf673370ac08d4a70c453b7
|
|
7
|
+
data.tar.gz: e5c67fd6a73ce4b8a14ea1b8595ea9796913861b799a3ddceaf3f31b8ae78172e62909c92f7cd73d1fde2d4264cb2ce99a450210b6e7ea9500968331f71a6c28
|
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,155 @@ 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.singularize.camelize(:lower)}: \"\#{#{class_name.singularize}.#{name.singularize.underscore}}\"\n"
|
|
663
|
+
when "bigint", "integer", "float", "boolean"
|
|
664
|
+
new_line.write " #{name.singularize.camelize(:lower)}: \#{#{class_name.singularize}.#{name.singularize.underscore}}\n"
|
|
665
|
+
when "date", "datetime"
|
|
666
|
+
new_line.write " #{name.singularize.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.singularize.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
|
|
774
|
+
def rspec_query class_name: "souls"
|
|
636
775
|
# if needed
|
|
637
776
|
end
|
|
638
777
|
|
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.9
|
|
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
|