souls 0.15.5 → 0.16.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: e72a21841cb1bad148b2b4fb2c9b6fc01fe55bf3b369bfb3aaf71df1393bd34f
4
- data.tar.gz: 1e60f71a7d2ad5734d7f8a6f18cca6b437148c7f4f9d08145fe5eddef81be639
3
+ metadata.gz: 228bc348ee98475ded06a4f957c7ebd98d0b3cd7559fa6526df7b7ac8b587a19
4
+ data.tar.gz: 39ad6984a3317fb407a18ef4fe0acf32ead125edb03787e667f580cfdc334ec8
5
5
  SHA512:
6
- metadata.gz: 0fbaa59c380970e79452516a7b049dd8815c0f65bd35dad5cd9f263adb700fe5b44b2e2b7ccd298ecfaf4c9e6c80966f1d955f9346a0799d8a2b242dbb305889
7
- data.tar.gz: 2d7ab88bd16ac812b1e751faf5f924e75e01dcb7be5b181867083bfb60d2611aadd92247c7be4d8fcfe99361055214d668107d45b61caf8a7216524c998ad20c
6
+ metadata.gz: f70d561219a5443ffca7e717dfb1106c080090e1345991b9c3721b0cc61789527cb8e5b97dbab500f32bc6a15b71276dcb654a5f8822333103e36f1d4dc0e90c
7
+ data.tar.gz: 96ecddf8f92a715dec2be50ccffb327d5e0ec7f0d6427b6002414ed6f0a72f0313ca0e5793e2590efe61d5efa63a13f1e0ab78c7d73dece6a3b6c4d311b37017
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.15.5)
4
+ souls (0.15.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -21,14 +21,18 @@
21
21
 
22
22
  Welcome to SOULs Framework!
23
23
 
24
- SOULS is a Web Application Framework for Microservices on Multi Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud. Auto deploy with scalable condition. You can focus on business logic. No more infra problems.
24
+ SOULS is a Web Application Framework based on GraphQL Relay ( Ruby )
25
+ This is Cloud Based APP Framework. Easy Deployment.
26
+ Microservices on Multi Cloud Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud. Auto deploy with scalable condition.
27
+ You can focus on business logic. No more infra problems.
25
28
 
26
- SOULs creates 4 types of framework.
29
+ SOULs creates 5 types of framework.
27
30
 
28
- 1. Service - gRPC Serverless Scalable Service (Ruby)
29
- 2. API - GraphQL to call gRPC (Ruby)
30
- 3. Media Web Client - Media web client with SSG (TypeScript)
31
- 4. Admin Web Client - Admin Console and CMS (TypeScript)
31
+ 1. API - GraphQL (Ruby) - Simple API
32
+ 2. API - GraphQL to call gRPC (Ruby) - for heavy task processes
33
+ 3. Service - gRPC Serverless Scalable Service (Ruby)
34
+ 4. Media Web Client - Media web client with SSG (TypeScript)
35
+ 5. Admin Web Client - Admin Console and CMS (TypeScript)
32
36
 
33
37
  ## Dependency
34
38
 
@@ -66,42 +70,80 @@ And Create Your APP
66
70
 
67
71
  ### Choose SOULs Type:
68
72
 
69
- 1. Service
70
- 2. API
71
- 3. Media Web
72
- 4. Admin Web
73
+ 1. API
74
+ 2. API - gRPC
75
+ 3. Service
76
+ 4. Media Web
77
+ 5. Admin Web
73
78
 
74
- ## Usage
79
+ ## Usage - 1. GraphQL API
75
80
 
76
- Version Check
81
+ ```bash
82
+ # Ruby version (using rbenv)
83
+ $ ruby -v
84
+ ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
77
85
 
78
- $ souls -v
86
+ # Install xcode
87
+ $ xcode-select --install
79
88
 
80
- Init Proto Files
89
+ # Install PostgreSQL (Mac env)
90
+ $ brew install postgresql
81
91
 
82
- $ souls p `service_name`
92
+ # Install redis
93
+ $ brew install redis
83
94
 
84
- Run Server
95
+ # Version Check
96
+ $ souls -v
85
97
 
86
- $ souls s
98
+ # Init SOULs App
99
+ $ souls new app_name
100
+ $ cd app_name
101
+ $ bundle
87
102
 
88
- Run Console
103
+ # Run Dev & Test DB
104
+ $ souls i run_psql
89
105
 
90
- $ souls c
106
+ # Create DB
107
+ $ souls db:create
91
108
 
92
- Run Infra Command
109
+ # Migrate DB
110
+ $ souls db:migrate
93
111
 
94
- $ souls i `method_name`
112
+ # Create Test DB
113
+ $ souls db:seed
95
114
 
96
- Deploy
115
+ # Development (localhost:3000/playground)
116
+ $ souls s
97
117
 
98
- $ souls i deploy
118
+ # Development with Worker (localhost:3000/playground; localhost:3000/sidekiq)
119
+ $ foreman start -f Procfile.dev
99
120
 
100
- ※Only Initial
121
+ # Test
122
+ $ bundle exec rspec
123
+
124
+ # Deploy (Edit: ./cloudbuild.yml)
125
+ $ souls deploy
126
+
127
+ # Run Infra Command
128
+ $ souls i `method_name`
129
+ ```
130
+
131
+ ## SOULs Scaffold
132
+ SOULs Scaffold creates CRUD API from `./db/schema.rb`
133
+
134
+ ```bash
135
+ # Create migration file
136
+ $ souls g migration user
137
+
138
+ # Edit migration file
139
+ # Migrate DB
140
+ $ souls db:migrate
141
+
142
+ # SOULs Scaffold
143
+ $ souls g migrate user
144
+ ```
101
145
 
102
- Update
103
146
 
104
- $ souls i update
105
147
 
106
148
  ## Development
107
149
 
data/exe/souls CHANGED
@@ -13,9 +13,9 @@ begin
13
13
  puts "you need to specify your app name \n `souls new app_name`"
14
14
  exit
15
15
  end
16
- puts "Which framework: \n 1. SOULS GraphQL API \n 2. SOULS GraphQL API gRPC compatible \n 3. SOULS gRPC Service \n 4. SOULS Media Web \n 5. SOULS Admin Web \n Enter Number: "
16
+ puts "Which framework: \n 1. SOULs GraphQL API \n 2. SOULs GraphQL API gRPC compatible \n 3. SOULs gRPC Service \n 4. SOULs Media Web \n 5. SOULs Admin Web \n Enter Number: "
17
17
  strain = STDIN.gets.chomp.to_i
18
- (1..5).include?(strain) ? puts("Generating Souls.. \n") : raise(StandardError, "Choose Number 1..5")
18
+ (1..5).include?(strain) ? puts("Generating SOULs.. \n") : raise(StandardError, "Choose Number 1..5")
19
19
  Souls::Init.create_souls strain: strain, app_name: ARGV[1]
20
20
  when "s", "server"
21
21
  strain = Souls.configuration.strain
@@ -25,7 +25,7 @@ begin
25
25
  when "service"
26
26
  system "bundle exec rake run_server"
27
27
  else
28
- `foreman start -f Procfile.dev`
28
+ `bundle exec puma -p 3000 -e development`
29
29
  end
30
30
  when "c", "console"
31
31
  strain = Souls.configuration.strain
@@ -86,6 +86,8 @@ begin
86
86
  STDOUT.write `rake db:create && rake db:create RACK_ENV=test`
87
87
  when "db:migrate"
88
88
  STDOUT.write `rake db:migrate && rake db:migrate RACK_ENV=test`
89
+ when "db:seed"
90
+ STDOUT.write `rake db:seed`
89
91
  when "db:migrate:reset"
90
92
  STDOUT.write `rake db:migrate:reset && rake db:migrate:reset RACK_ENV=test`
91
93
  when "t", "test"
@@ -18,7 +18,7 @@ module Souls
18
18
  def resolver class_name: "souls"
19
19
  FileUtils.mkdir_p "./app/graphql/resolvers" unless Dir.exist? "./app/graphql/resolvers"
20
20
  file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
21
- return ["Aleady Exist!"] if File.exist? file_path
21
+ return ["Resolver already exist! #{file_path}"] if File.exist? file_path
22
22
  File.open(file_path, "w") do |f|
23
23
  f.write <<~EOS
24
24
  module Resolvers
@@ -80,7 +80,7 @@ module Souls
80
80
 
81
81
  def job class_name: "send_mail"
82
82
  file_path = "./app/jobs/#{class_name.singularize}_job.rb"
83
- return ["Aleady Exist!"] if File.exist? file_path
83
+ return ["Job already exist! #{file_path}"] if File.exist? file_path
84
84
  File.open(file_path, "w") do |f|
85
85
  f.write <<~EOS
86
86
  class #{class_name.camelize}
@@ -99,6 +99,7 @@ module Souls
99
99
 
100
100
  def rspec_resolver_head class_name: "souls"
101
101
  file_path = "./spec/resolvers/#{class_name.singularize}_search_spec.rb"
102
+ puts file_path
102
103
  File.open(file_path, "w") do |f|
103
104
  f.write <<~EOS
104
105
  RSpec.describe \"#{class_name.camelize}Search Resolver テスト\" do
@@ -120,7 +121,7 @@ module Souls
120
121
  if line.include?("end") || line.include?("t.index")
121
122
  if @relation_params.empty?
122
123
  new_line.write <<-EOS
123
- let(:#{class_name}) { FactoryBot.create(:#{class_name}) }
124
+ let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
124
125
 
125
126
  let(:query) do
126
127
  %(query {
@@ -196,8 +197,12 @@ module Souls
196
197
  end
197
198
 
198
199
  it "return #{class_name.camelize} Data" do
199
- a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
200
- p result if a1.nil?
200
+ begin
201
+ a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
202
+ raise unless a1.present?
203
+ rescue
204
+ raise StandardError, result
205
+ end
201
206
  expect(a1).to include(
202
207
  "id" => be_a(String),
203
208
  EOS
@@ -269,7 +274,7 @@ end
269
274
  def rspec_resolver class_name: "souls"
270
275
  singularized_class_name = class_name.singularize
271
276
  file_path = "#{Dir.pwd}/spec/resolvers/#{singularized_class_name}_search_spec.rb"
272
- return ["Aleady Exist!"] if File.exist? file_path
277
+ return ["Resolver already exist! #{file_path}"] if File.exist? file_path
273
278
  rspec_resolver_head class_name: singularized_class_name
274
279
  rspec_resolver_after_head class_name: singularized_class_name
275
280
  rspec_resolver_params class_name: singularized_class_name
data/lib/souls/init.rb CHANGED
@@ -724,7 +724,8 @@ module Souls
724
724
  end
725
725
 
726
726
  def rspec_factory class_name: "souls"
727
- return ["Aleady Exist!"] if File.exist? "./spec/factories/#{class_name.singularize}"
727
+ file_path = "./spec/factories/#{class_name.pluralize}.rb"
728
+ return ["Factory aleady exist! #{file_path}"] if File.exist? file_path
728
729
  singularized_class_name = class_name.singularize
729
730
  rspec_factory_head class_name: singularized_class_name
730
731
  rspec_factory_params class_name: singularized_class_name
@@ -881,7 +882,12 @@ module Souls
881
882
  end
882
883
 
883
884
  it "return #{class_name.camelize} Data" do
884
- a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}Edge", "node")
885
+ begin
886
+ a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}Edge", "node")
887
+ raise unless a1.present?
888
+ rescue
889
+ raise StandardError, result
890
+ end
885
891
  expect(a1).to include(
886
892
  "id" => be_a(String),
887
893
  EOS
@@ -899,7 +905,12 @@ module Souls
899
905
  end
900
906
 
901
907
  it "return #{class_name.camelize} Data" do
902
- a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}Edge", "node")
908
+ begin
909
+ a1 = result.dig("data", "create#{class_name.singularize.camelize}", "#{class_name.singularize.camelize(:lower)}Edge", "node")
910
+ raise unless a1.present?
911
+ rescue
912
+ raise StandardError, result
913
+ end
903
914
  expect(a1).to include(
904
915
  "id" => be_a(String),
905
916
  EOS
@@ -1006,7 +1017,7 @@ module Souls
1006
1017
  if line.include?("end") || line.include?("t.index")
1007
1018
  if @relation_params.empty?
1008
1019
  new_line.write <<-EOS
1009
- let(:#{class_name}) { FactoryBot.create(:#{class_name}) }
1020
+ let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
1010
1021
 
1011
1022
  let(:query) do
1012
1023
  data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
@@ -1064,7 +1075,12 @@ module Souls
1064
1075
  end
1065
1076
 
1066
1077
  it "return #{class_name.camelize} Data" do
1067
- a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}")
1078
+ begin
1079
+ a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}")
1080
+ raise unless a1.present?
1081
+ rescue
1082
+ raise StandardError, result
1083
+ end
1068
1084
  expect(a1).to include(
1069
1085
  "id" => be_a(String),
1070
1086
  EOS
@@ -1203,6 +1219,9 @@ module Souls
1203
1219
  " field :update_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Update#{singularized_class_name.camelize}",
1204
1220
  " field :delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::Delete#{singularized_class_name.camelize}",
1205
1221
  " field :destroy_delete_#{singularized_class_name}, mutation: Mutations::#{singularized_class_name.camelize}::DestroyDelete#{singularized_class_name.camelize}"
1222
+ ],
1223
+ add_resolver: [
1224
+ " field :#{singularized_class_name}_search, resolver: Resolvers::#{singularized_class_name.camelize}Search"
1206
1225
  ]
1207
1226
  ]
1208
1227
  end
@@ -1232,6 +1251,10 @@ module Souls
1232
1251
  result[0][:add_query_type].each do |path|
1233
1252
  puts path
1234
1253
  end
1254
+ puts "\n ## Resolvers\n\n"
1255
+ result[0][:add_resolver].each do |path|
1256
+ puts path
1257
+ end
1235
1258
  puts "\n ## Connection Type\n\n"
1236
1259
  puts " def #{class_name.pluralize}"
1237
1260
  puts " #{class_name.singularize.camelize}.all.order(id: :desc)"
@@ -1267,7 +1290,7 @@ module Souls
1267
1290
  puts "\n============== Resolver =======================\n\n"
1268
1291
  paths.each do |class_name|
1269
1292
  class_name.each do |path|
1270
- path[:resovler].each { |line| puts line }
1293
+ path[:resolver].each { |line| puts line }
1271
1294
  end
1272
1295
  end
1273
1296
  puts "\n============== NodeType =======================\n\n"
@@ -1330,6 +1353,12 @@ module Souls
1330
1353
  path[:add_query_type].each { |line| puts line }
1331
1354
  end
1332
1355
  end
1356
+ puts "\n ## Resolvers\n\n"
1357
+ paths.each do |class_name|
1358
+ class_name.each do |path|
1359
+ path[:add_resolver].each { |line| puts line }
1360
+ end
1361
+ end
1333
1362
  puts "\n ## Connection Type\n\n"
1334
1363
  get_tables.each do |class_name|
1335
1364
  puts " def #{class_name.pluralize}"
data/lib/souls/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.15.5"
2
+ VERSION = "0.16.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.15.5
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubygems_version: 3.2.4
73
+ rubygems_version: 3.2.3
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: SOULS is a GraphQL Based Web Application Framework for Microservices on Multi