souls 0.68.5 → 0.70.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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/lib/souls/cli/delete/application.rb +67 -0
  4. data/lib/souls/cli/delete/connection.rb +16 -0
  5. data/lib/souls/cli/delete/connection_rbs.rb +19 -0
  6. data/lib/souls/cli/delete/edge.rb +16 -0
  7. data/lib/souls/cli/delete/edge_rbs.rb +19 -0
  8. data/lib/souls/cli/delete/index.rb +18 -0
  9. data/lib/souls/cli/delete/job.rb +39 -0
  10. data/lib/souls/cli/delete/job_rbs.rb +20 -0
  11. data/lib/souls/cli/delete/manager.rb +20 -0
  12. data/lib/souls/cli/delete/manager_rbs.rb +20 -0
  13. data/lib/souls/cli/delete/mutation.rb +17 -0
  14. data/lib/souls/cli/delete/mutation_rbs.rb +17 -0
  15. data/lib/souls/cli/delete/policy.rb +15 -0
  16. data/lib/souls/cli/delete/policy_rbs.rb +19 -0
  17. data/lib/souls/cli/delete/query.rb +14 -0
  18. data/lib/souls/cli/delete/query_rbs.rb +16 -0
  19. data/lib/souls/cli/delete/resolver.rb +14 -0
  20. data/lib/souls/cli/delete/resolver_rbs.rb +19 -0
  21. data/lib/souls/cli/delete/rspec_factory.rb +13 -0
  22. data/lib/souls/cli/delete/rspec_job.rb +14 -0
  23. data/lib/souls/cli/delete/rspec_manager.rb +15 -0
  24. data/lib/souls/cli/delete/rspec_mutation.rb +14 -0
  25. data/lib/souls/cli/delete/rspec_policy.rb +14 -0
  26. data/lib/souls/cli/delete/rspec_query.rb +14 -0
  27. data/lib/souls/cli/delete/rspec_resolver.rb +14 -0
  28. data/lib/souls/cli/delete/type.rb +14 -0
  29. data/lib/souls/cli/delete/type_rbs.rb +19 -0
  30. data/lib/souls/cli/generate/application.rb +0 -24
  31. data/lib/souls/cli/generate/type.rb +1 -4
  32. data/lib/souls/cli/index.rb +1 -0
  33. data/lib/souls/cli/sync/model.rb +1 -1
  34. data/lib/souls/cli/upgrade/submodule.rb +1 -1
  35. data/lib/souls/cli.rb +4 -0
  36. data/lib/souls/version.rb +1 -1
  37. data/lib/souls/versions/.souls_api_version +1 -1
  38. data/lib/souls/versions/.souls_worker_version +1 -1
  39. metadata +32 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50e374db1891821d585cf2e326ec95d76b1727b4eb8abb7fb2b450df2e56419c
4
- data.tar.gz: b43541b3a9c59a8cd6486e6760b0600783c976b5165ab7418fca23b0c90da671
3
+ metadata.gz: c5f1f81de877043807192efa739ad9ab10478e24c2a7dbc1b2fc44bb138d0b60
4
+ data.tar.gz: af6f1713d21fbbd8a5bd1f6ae7d29be36d31f2b0b32c9b4aa2024051775a4c36
5
5
  SHA512:
6
- metadata.gz: 28648c3fc8fe7ad1801a8d9813898c7eeb0f0fbf92f2425dfe4e586f6c679fd56688821a17d5b22709a94b44034586bd51f8403803b6630bb0f7549f7ebb70ad
7
- data.tar.gz: 4d0de95b86254a8ce0a6cebe33ee2b31c8a1e4e0d06243d925e33d86575665c46f47cf8b3ddc8244c3725e57968e87bbcb553e693b4610bb34797782bd37414a
6
+ metadata.gz: d448d65e700e0ca81f2bd4f80657de021633d0cf31fc5b3ad1bc5e3938fa489671cff5e322fd2f448216e1531fb37c4b14fb7d9bf28276a3360a05850f01e27a
7
+ data.tar.gz: 7e2b752564b89f51595852f28a2a18b2580a9b1305dace7dc2c3d79af526c7774cbd2a4853fc13b7d6458b0b8f67a3a610b9bfaceb7a08597a7c378ea41cd011
data/README.md CHANGED
@@ -17,6 +17,11 @@
17
17
  </a>
18
18
  </p>
19
19
 
20
+ ## SOULs Serverless Application Framework Document
21
+
22
+ - [Go to SOULs Document](https://souls.elsoul.nl/)
23
+
24
+
20
25
  ## What's SOULs?
21
26
 
22
27
  Welcome to SOULs Serverless Application Framework!
@@ -31,7 +36,7 @@ Powered by Ruby GraphQL, RBS/Steep, Active Record, RSpec, RuboCop, and Google Cl
31
36
  ![画像](https://souls.elsoul.nl/imgs/docs/SOULs-architecture.jpg)
32
37
 
33
38
 
34
- SOULs creates 2 types of framework.
39
+ SOULs creates 2 types of APP.
35
40
 
36
41
  1. API - GraphQL (Ruby) - Simple API - Cloud Run
37
42
  2. Worker - Google Pub/Sub Messaging Worker API (Ruby) - Cloud Run
@@ -84,9 +89,6 @@ Check your GraphQL PlayGround
84
89
  [localhost:4000/playground](localhost:4000/playground)
85
90
 
86
91
 
87
- ## SOULs Serverless Application Framework Document
88
-
89
- - [SOULs Document](https://souls.elsoul.nl/)
90
92
 
91
93
  ## Development
92
94
 
@@ -0,0 +1,67 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "scaffold [CLASS_NAME]", "Delete Scaffold"
4
+ method_option :rbs, type: :boolean, aliases: "--rbs", default: false, desc: "Deletes Only RBS Files"
5
+ def scaffold(class_name)
6
+ singularized_class_name = class_name.singularize
7
+ if options[:rbs]
8
+ run_rbs_scaffold(class_name: singularized_class_name)
9
+ else
10
+ run_scaffold(class_name: singularized_class_name)
11
+ end
12
+ true
13
+ rescue Thor::Error => e
14
+ raise(Thor::Error, e)
15
+ end
16
+
17
+ desc "scaffold_all", "Delete Scaffold All Tables from schema.rb"
18
+ method_option :rbs, type: :boolean, aliases: "--rbs", default: false, desc: "Deletes Only RBS Files"
19
+ def scaffold_all
20
+ puts(Paint["Delete All Scaffold Files!\n", :cyan])
21
+ Souls.get_tables.each do |table|
22
+ if options[:rbs]
23
+ Souls::Delete.new.invoke(:scaffold, [table.singularize], { rbs: options[:rbs] })
24
+ else
25
+ Souls::Delete.new.invoke(:scaffold, [table.singularize], {})
26
+ end
27
+ end
28
+ true
29
+ rescue Thor::Error => e
30
+ raise(Thor::Error, e)
31
+ end
32
+
33
+ private
34
+
35
+ def run_scaffold(class_name: "user")
36
+ type(class_name)
37
+ type_rbs(class_name)
38
+ query(class_name)
39
+ query_rbs(class_name)
40
+ mutation(class_name)
41
+ mutation_rbs(class_name)
42
+ policy(class_name)
43
+ policy_rbs(class_name)
44
+ edge(class_name)
45
+ edge_rbs(class_name)
46
+ connection(class_name)
47
+ connection_rbs(class_name)
48
+ resolver(class_name)
49
+ resolver_rbs(class_name)
50
+ rspec_factory(class_name)
51
+ rspec_mutation(class_name)
52
+ rspec_query(class_name)
53
+ rspec_resolver(class_name)
54
+ rspec_policy(class_name)
55
+ end
56
+
57
+ def run_rbs_scaffold(class_name: "user")
58
+ type_rbs(class_name)
59
+ query_rbs(class_name)
60
+ mutation_rbs(class_name)
61
+ policy_rbs(class_name)
62
+ edge_rbs(class_name)
63
+ connection_rbs(class_name)
64
+ resolver_rbs(class_name)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,16 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "connection [CLASS_NAME]", "Delete GraphQL Connection"
4
+ def connection(class_name)
5
+ file_dir = "./app/graphql/types/connections/"
6
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
7
+ singularized_class_name = class_name.underscore.singularize
8
+ file_path = "./app/graphql/types/connections/#{singularized_class_name}_connection.rb"
9
+ FileUtils.rm(file_path)
10
+ puts(Paint % ["Delete file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ file_path
12
+ rescue Thor::Error => e
13
+ raise(Thor::Error, e)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "connection_rbs [CLASS_NAME]", "Delete GraphQL Connection RBS"
4
+ def connection_rbs(class_name)
5
+ file_path = ""
6
+ Dir.chdir(Souls.get_mother_path.to_s) do
7
+ file_dir = "./sig/api/app/graphql/types/connections/"
8
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
+ singularized_class_name = class_name.underscore.singularize
10
+ file_path = "#{file_dir}#{singularized_class_name}_connection.rbs"
11
+ FileUtils.rm(file_path)
12
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
13
+ end
14
+ file_path
15
+ rescue Thor::Error => e
16
+ raise(Thor::Error, e)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "edge [CLASS_NAME]", "Delete GraphQL Edge"
4
+ def edge(class_name)
5
+ file_dir = "./app/graphql/types/edges"
6
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
7
+ singularized_class_name = class_name.underscore.singularize
8
+ file_path = "./app/graphql/types/edges/#{singularized_class_name}_edge.rb"
9
+ FileUtils.rm(file_path)
10
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
11
+ file_path
12
+ rescue Thor::Error => e
13
+ raise(Thor::Error, e)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "edge_rbs [CLASS_NAME]", "Delete GraphQL Edge RBS"
4
+ def edge_rbs(class_name)
5
+ file_path = ""
6
+ Dir.chdir(Souls.get_mother_path.to_s) do
7
+ file_dir = "./sig/api/app/graphql/types/edges/"
8
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
+ singularized_class_name = class_name.underscore.singularize
10
+ file_path = "#{file_dir}#{singularized_class_name}_edge.rbs"
11
+ FileUtils.rm(file_path)
12
+ puts(Paint % ["Delete file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
13
+ end
14
+ file_path
15
+ rescue Thor::Error => e
16
+ raise(Thor::Error, e)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ require_paths = []
2
+ dev_path = "lib/souls/cli/delete/*"
3
+ souls_path = Dir["#{Gem.dir}/gems/souls-*"].last
4
+ gem_path = "#{souls_path}/lib/souls/cli/delete/*"
5
+ file_paths = File.exist?("souls.gemspec") ? dev_path : gem_path
6
+ Dir[file_paths].map do |n|
7
+ next if n.include?("index.rb")
8
+
9
+ require_paths << n.split("/").last.gsub(".rb", "")
10
+ end
11
+ require_paths.each do |path|
12
+ require_relative "./#{path}"
13
+ end
14
+
15
+ module Souls
16
+ class Delete < Thor
17
+ end
18
+ end
@@ -0,0 +1,39 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "job [CLASS_NAME]", "Delete Job File in Worker"
4
+ method_option :mailer, type: :boolean, aliases: "--mailer", default: false, desc: "Mailer Option"
5
+ def job(class_name)
6
+ if options[:mailer]
7
+ mailgun_mailer(class_name: class_name)
8
+ else
9
+ delete_job_mutation(class_name: class_name)
10
+ end
11
+ Souls::Delete.new.invoke(:job_rbs, [class_name], {})
12
+ Souls::Delete.new.invoke(:rspec_job, [class_name], {})
13
+ rescue Thor::Error => e
14
+ raise(Thor::Error, e)
15
+ end
16
+
17
+ private
18
+
19
+ def delete_job_mutation(class_name: "send-mailer")
20
+ file_dir = "./app/graphql/mutations/"
21
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
22
+ file_path = "#{file_dir}#{class_name.singularize}.rb"
23
+
24
+ FileUtils.rm(file_path)
25
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
26
+ file_path
27
+ end
28
+
29
+ def mailgun_mailer(class_name: "mailer")
30
+ file_dir = "./app/graphql/mutations/"
31
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
32
+ file_path = "#{file_dir}#{class_name.singularize}.rb"
33
+
34
+ FileUtils.rm(file_path)
35
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
36
+ file_path
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "job_rbs [CLASS_NAME]", "Delete SOULs Job Mutation RBS Template"
4
+ def job_rbs(class_name)
5
+ file_path = ""
6
+ worker_name = FileUtils.pwd.split("/").last
7
+ Dir.chdir(Souls.get_mother_path.to_s) do
8
+ singularized_class_name = class_name.underscore.singularize
9
+ file_dir = "./sig/#{worker_name}/app/graphql/mutations/"
10
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
11
+ file_path = "#{file_dir}#{singularized_class_name}.rbs"
12
+ FileUtils.rm(file_path)
13
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
+ end
15
+ file_path
16
+ rescue Thor::Error => e
17
+ raise(Thor::Error, e)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "manager [MANAGER_NAME]", "Delete GraphQL Mutation Template"
4
+ method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
5
+ def manager(class_name)
6
+ singularized_class_name = class_name.underscore.singularize
7
+ file_dir = "./app/graphql/mutations/managers/#{singularized_class_name}_manager"
8
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
+ file_path = "#{file_dir}/#{options[:mutation]}.rb"
10
+
11
+ FileUtils.rm(file_path)
12
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
13
+ Souls::Delete.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
14
+ Souls::Delete.new.invoke(:rspec_manager, [singularized_class_name], { mutation: options[:mutation] })
15
+ file_path
16
+ rescue Thor::Error => e
17
+ raise(Thor::Error, e)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "manager_rbs [CLASS_NAME]", "Delete SOULs Manager RBS Template"
4
+ method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
5
+ def manager_rbs(class_name)
6
+ file_path = ""
7
+ singularized_class_name = class_name.underscore.singularize
8
+ Dir.chdir(Souls.get_mother_path.to_s) do
9
+ file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
10
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
11
+ file_path = "#{file_dir}/#{options[:mutation]}.rbs"
12
+ FileUtils.rm(file_path)
13
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
+ end
15
+ file_path
16
+ rescue Thor::Error => e
17
+ raise(Thor::Error, e)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "mutation [CLASS_NAME]", "Delete GraphQL Mutation"
4
+ def mutation(class_name)
5
+ singularized_class_name = class_name.singularize
6
+ file_path = ""
7
+ Dir.chdir(Souls.get_api_path.to_s) do
8
+ file_path = "./app/graphql/mutations/base/#{singularized_class_name}/"
9
+ FileUtils.rm_rf(file_path)
10
+ end
11
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
12
+ file_path
13
+ rescue Thor::Error => e
14
+ raise(Thor::Error, e)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "mutation_rbs [CLASS_NAME]", "Delete GraphQL Mutation RBS"
4
+ def mutation_rbs(class_name)
5
+ singularized_class_name = class_name.underscore.singularize
6
+ file_path = ""
7
+ Dir.chdir(Souls.get_mother_path.to_s) do
8
+ file_dir = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
9
+ FileUtils.rm_rf(file_dir)
10
+ end
11
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
12
+ file_path
13
+ rescue Thor::Error => e
14
+ raise(Thor::Error, e)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "policy [CLASS_NAME]", "Delete Policy File Template"
4
+ def policy(class_name)
5
+ dir_name = "./app/policies"
6
+ FileUtils.mkdir_p(dir_name) unless Dir.exist?(dir_name)
7
+ file_path = "#{dir_name}/#{class_name.singularize}_policy.rb"
8
+ FileUtils.rm(file_path)
9
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
10
+ file_path
11
+ rescue Thor::Error => e
12
+ raise(Thor::Error, e)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "policy_rbs [CLASS_NAME]", "Delete Policy RBS"
4
+ def policy_rbs(class_name)
5
+ file_path = ""
6
+ Dir.chdir(Souls.get_mother_path.to_s) do
7
+ file_dir = "./sig/api/app/graphql/policies/"
8
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
+ singularized_class_name = class_name.underscore.singularize
10
+ file_path = "#{file_dir}#{singularized_class_name}_policy.rbs"
11
+ FileUtils.rm(file_path)
12
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
13
+ end
14
+ file_path
15
+ rescue Thor::Error => e
16
+ raise(Thor::Error, e)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "query [CLASS_NAME]", "Delete GraphQL Query"
4
+ def query(class_name)
5
+ singularized_class_name = class_name.singularize
6
+ file_path = "./app/graphql/queries/#{singularized_class_name}*.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "query_rbs [CLASS_NAME]", "Delete GraphQL Query RBS"
4
+ def query_rbs(class_name)
5
+ file_path = ""
6
+ Dir.chdir(Souls.get_mother_path.to_s) do
7
+ file_dir = "./sig/api/app/graphql/queries/"
8
+ singularized_class_name = class_name.underscore.singularize
9
+ file_path = "#{file_dir}#{singularized_class_name}*.rbs"
10
+ FileUtils.rm(file_path)
11
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
12
+ file_path
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "resolver [CLASS_NAME]", "Delete GraphQL Resolver"
4
+ def resolver(class_name)
5
+ singularized_class_name = class_name.singularize.underscore
6
+ file_path = "./app/graphql/resolvers/#{singularized_class_name}_search.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "resolver_rbs [CLASS_NAME]", "Delete GraphQL Resolver RBS"
4
+ def resolver_rbs(class_name)
5
+ singularized_class_name = class_name.underscore.singularize
6
+ file_path = ""
7
+ Dir.chdir(Souls.get_mother_path.to_s) do
8
+ file_dir = "./sig/api/app/graphql/resolvers"
9
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
+ file_path = "#{file_dir}/#{singularized_class_name}_search.rbs"
11
+ FileUtils.rm(file_path)
12
+ end
13
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
+ file_path
15
+ rescue Thor::Error => e
16
+ raise(Thor::Error, e)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "rspec_factory [CLASS_NAME]", "Delete Rspec Factory Test from schema.rb"
4
+ def rspec_factory(class_name)
5
+ file_path = "./spec/factories/#{class_name.pluralize}.rb"
6
+ FileUtils.rm(file_path)
7
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
8
+ file_path
9
+ rescue Thor::Error => e
10
+ raise(Thor::Error, e)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "rspec_job [CLASS_NAME]", "Delete Rspec Job Test Template"
4
+ def rspec_job(class_name)
5
+ singularized_class_name = class_name.underscore.singularize
6
+ file_path = "#{file_dir}/#{singularized_class_name}_spec.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "rspec_manager [CLASS_NAME]", "Delete Rspec Manager Test Template"
4
+ method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
5
+ def rspec_manager(class_name)
6
+ singularized_class_name = class_name.underscore.singularize
7
+ file_path = "./spec/mutations/managers/#{singularized_class_name}/#{options[:mutation]}_spec.rb"
8
+ FileUtils.rm(file_path)
9
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
10
+ file_path
11
+ rescue Thor::Error => e
12
+ raise(Thor::Error, e)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "rspec_mutation [CLASS_NAME]", "Delete Rspec Mutation Test from schema.rb"
4
+ def rspec_mutation(class_name)
5
+ singularized_class_name = class_name.singularize
6
+ file_path = "./spec/mutations/base/#{singularized_class_name}_spec.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue StandardError => e
11
+ raise(StandardError, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "rspec_policy [CLASS_NAME]", "Delete Rspec Policy Test"
4
+ def rspec_policy(class_name)
5
+ singularized_class_name = class_name.singularize
6
+ file_path = "./spec/policies/#{singularized_class_name}_policy_spec.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "rspec_query [CLASS_NAME]", "Delete Rspec Query Test"
4
+ def rspec_query(class_name)
5
+ singularized_class_name = class_name.singularize
6
+ file_path = "./spec/queries/#{singularized_class_name}_spec.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "rspec_resolver [CLASS_NAME]", "Delete Rspec Resolver Test"
4
+ def rspec_resolver(class_name)
5
+ singularized_class_name = class_name.singularize
6
+ file_path = "./spec/resolvers/#{singularized_class_name}_search_spec.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "type [CLASS_NAME]", "Delete GraphQL Type"
4
+ def type(class_name)
5
+ singularized_class_name = class_name.singularize
6
+ file_path = "./app/graphql/types/#{singularized_class_name}_type.rb"
7
+ FileUtils.rm(file_path)
8
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
9
+ file_path
10
+ rescue Thor::Error => e
11
+ raise(Thor::Error, e)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module Souls
2
+ class Delete < Thor
3
+ desc "type_rbs [CLASS_NAME]", "Delete GraphQL Type RBS"
4
+ def type_rbs(class_name)
5
+ singularized_class_name = class_name.underscore.singularize
6
+ file_path = ""
7
+ Dir.chdir(Souls.get_mother_path.to_s) do
8
+ file_dir = "./sig/api/app/graphql/types"
9
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
+ file_path = "#{file_dir}/#{singularized_class_name}_type.rbs"
11
+ FileUtils.rm(file_path)
12
+ end
13
+ puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
14
+ file_path
15
+ rescue Thor::Error => e
16
+ raise(Thor::Error, e)
17
+ end
18
+ end
19
+ end
@@ -30,30 +30,6 @@ module Souls
30
30
  raise(Thor::Error, e)
31
31
  end
32
32
 
33
- desc "delete_all [CLASS_NAME]", "Generate Scaffold All Tables from schema.rb"
34
- def delete_all(class_name)
35
- singularized_class_name = class_name.singularize.underscore
36
- pluralized_class_name = class_name.pluralize.underscore
37
- FileUtils.rm("./app/models/#{singularized_class_name}.rb")
38
- FileUtils.rm("./app/policies/#{singularized_class_name}_policy.rb")
39
- FileUtils.rm_rf("./app/graphql/mutations/base/#{singularized_class_name}")
40
- FileUtils.rm("./app/graphql/queries/#{singularized_class_name}.rb")
41
- FileUtils.rm("./app/graphql/queries/#{pluralized_class_name}.rb")
42
- FileUtils.rm("./app/graphql/resolvers/#{singularized_class_name}_search.rb")
43
- FileUtils.rm("./app/graphql/types/#{singularized_class_name}_type.rb")
44
- FileUtils.rm("./app/graphql/types/edges/#{singularized_class_name}_edge.rb")
45
- FileUtils.rm("./app/graphql/types/connections/#{singularized_class_name}_connection.rb")
46
- FileUtils.rm("./spec/factories/#{pluralized_class_name}.rb")
47
- FileUtils.rm("./spec/mutations/base/#{singularized_class_name}_spec.rb")
48
- FileUtils.rm("./spec/models/#{singularized_class_name}_spec.rb")
49
- FileUtils.rm("./spec/queries/#{singularized_class_name}_spec.rb")
50
- FileUtils.rm("./spec/policies/#{singularized_class_name}_policy_spec.rb")
51
- FileUtils.rm("./spec/resolvers/#{singularized_class_name}_search_spec.rb")
52
- puts(Paint["deleted #{class_name.camelize} CRUD!", :yellow])
53
- rescue Thor::Error => e
54
- raise(Thor::Error, e)
55
- end
56
-
57
33
  private
58
34
 
59
35
  def run_scaffold(class_name: "user")
@@ -49,10 +49,7 @@ module Souls
49
49
  " field :#{name.gsub(
50
50
  '_id',
51
51
  ''
52
- )}, Types::#{name.gsub(
53
- '_id',
54
- ''
55
- ).singularize.camelize}Type, null: false\n"
52
+ )}, Types::#{name.gsub('_id', '').singularize.camelize}Type, null: false\n"
56
53
  )
57
54
  else
58
55
  new_line.write(" field :#{name}, #{field}, null: true\n")
@@ -3,6 +3,7 @@ require_relative "./generate/index"
3
3
  require_relative "./update/index"
4
4
  require_relative "./create/index"
5
5
  require_relative "./db/index"
6
+ require_relative "./delete/index"
6
7
  require_relative "./docker/index"
7
8
  require_relative "./gcloud/index"
8
9
  require_relative "./init/index"
@@ -15,7 +15,7 @@ module Souls
15
15
 
16
16
  def cp_and_dl_files(dir: "db")
17
17
  require("#{Souls.get_mother_path}/config/souls")
18
- worker_paths = Souls.configuration.workers.map { |n| n[:name] }
18
+ worker_paths = Souls.configuration.workers.map { |n| n[:name].split("-").last }
19
19
  worker_paths.each do |path|
20
20
  cp_path = "./apps/api/#{dir}"
21
21
  old_path = "./apps/#{path}/#{dir}"
@@ -5,4 +5,4 @@ module Souls
5
5
  system("git submodule update --init https://github.com/ruby/gem_rbs_collection.git vendor/rbs/gem_rbs_collection")
6
6
  end
7
7
  end
8
- end
8
+ end
data/lib/souls/cli.rb CHANGED
@@ -13,6 +13,9 @@ module Souls
13
13
  desc "db [COMMAND]", "SOULs DB Commands"
14
14
  subcommand "db", DB
15
15
 
16
+ desc "delete [COMMAND]", "SOULs Delete Commands"
17
+ subcommand "delete", Delete
18
+
16
19
  desc "docker [COMMAND]", "SOULs Docker Commands"
17
20
  subcommand "docker", Docker
18
21
 
@@ -30,6 +33,7 @@ module Souls
30
33
  map "s" => :server
31
34
  map "g" => :generate
32
35
  map "t" => :test
36
+ map "d" => :delete
33
37
  map ["-v", "--v", "--version", "-version"] => :version
34
38
  # rubocop:enable Style/StringHashKeys
35
39
 
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.68.5".freeze
2
+ VERSION = "0.70.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.47.5
1
+ 0.49.0
@@ -1 +1 @@
1
- 0.47.5
1
+ 0.49.0
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.68.5
4
+ version: 0.70.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
8
8
  - KishiTheMechanic
9
9
  - James Neve
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-10-06 00:00:00.000000000 Z
13
+ date: 2021-10-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -134,6 +134,33 @@ files:
134
134
  - lib/souls/cli/db/model.rb
135
135
  - lib/souls/cli/db/model_rbs.rb
136
136
  - lib/souls/cli/db/rspec_model.rb
137
+ - lib/souls/cli/delete/application.rb
138
+ - lib/souls/cli/delete/connection.rb
139
+ - lib/souls/cli/delete/connection_rbs.rb
140
+ - lib/souls/cli/delete/edge.rb
141
+ - lib/souls/cli/delete/edge_rbs.rb
142
+ - lib/souls/cli/delete/index.rb
143
+ - lib/souls/cli/delete/job.rb
144
+ - lib/souls/cli/delete/job_rbs.rb
145
+ - lib/souls/cli/delete/manager.rb
146
+ - lib/souls/cli/delete/manager_rbs.rb
147
+ - lib/souls/cli/delete/mutation.rb
148
+ - lib/souls/cli/delete/mutation_rbs.rb
149
+ - lib/souls/cli/delete/policy.rb
150
+ - lib/souls/cli/delete/policy_rbs.rb
151
+ - lib/souls/cli/delete/query.rb
152
+ - lib/souls/cli/delete/query_rbs.rb
153
+ - lib/souls/cli/delete/resolver.rb
154
+ - lib/souls/cli/delete/resolver_rbs.rb
155
+ - lib/souls/cli/delete/rspec_factory.rb
156
+ - lib/souls/cli/delete/rspec_job.rb
157
+ - lib/souls/cli/delete/rspec_manager.rb
158
+ - lib/souls/cli/delete/rspec_mutation.rb
159
+ - lib/souls/cli/delete/rspec_policy.rb
160
+ - lib/souls/cli/delete/rspec_query.rb
161
+ - lib/souls/cli/delete/rspec_resolver.rb
162
+ - lib/souls/cli/delete/type.rb
163
+ - lib/souls/cli/delete/type_rbs.rb
137
164
  - lib/souls/cli/docker/index.rb
138
165
  - lib/souls/cli/gcloud/compute/index.rb
139
166
  - lib/souls/cli/gcloud/iam/index.rb
@@ -203,7 +230,7 @@ metadata:
203
230
  homepage_uri: https://souls.elsoul.nl
204
231
  source_code_uri: https://github.com/elsoul/souls
205
232
  changelog_uri: https://github.com/elsoul/souls
206
- post_install_message:
233
+ post_install_message:
207
234
  rdoc_options: []
208
235
  require_paths:
209
236
  - lib
@@ -219,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
246
  version: '0'
220
247
  requirements: []
221
248
  rubygems_version: 3.2.22
222
- signing_key:
249
+ signing_key:
223
250
  specification_version: 4
224
251
  summary: Build Serverless Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep,
225
252
  Active Record, RSpec, RuboCop, and Google Cloud.