souls 0.68.7 → 0.69.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/souls/cli/delete/application.rb +67 -0
  3. data/lib/souls/cli/delete/connection.rb +16 -0
  4. data/lib/souls/cli/delete/connection_rbs.rb +19 -0
  5. data/lib/souls/cli/delete/edge.rb +16 -0
  6. data/lib/souls/cli/delete/edge_rbs.rb +19 -0
  7. data/lib/souls/cli/delete/index.rb +18 -0
  8. data/lib/souls/cli/delete/job.rb +39 -0
  9. data/lib/souls/cli/delete/job_rbs.rb +20 -0
  10. data/lib/souls/cli/delete/manager.rb +20 -0
  11. data/lib/souls/cli/delete/manager_rbs.rb +20 -0
  12. data/lib/souls/cli/delete/mutation.rb +17 -0
  13. data/lib/souls/cli/delete/mutation_rbs.rb +17 -0
  14. data/lib/souls/cli/delete/policy.rb +15 -0
  15. data/lib/souls/cli/delete/policy_rbs.rb +19 -0
  16. data/lib/souls/cli/delete/query.rb +14 -0
  17. data/lib/souls/cli/delete/query_rbs.rb +16 -0
  18. data/lib/souls/cli/delete/resolver.rb +14 -0
  19. data/lib/souls/cli/delete/resolver_rbs.rb +19 -0
  20. data/lib/souls/cli/delete/rspec_factory.rb +13 -0
  21. data/lib/souls/cli/delete/rspec_job.rb +14 -0
  22. data/lib/souls/cli/delete/rspec_manager.rb +15 -0
  23. data/lib/souls/cli/delete/rspec_mutation.rb +14 -0
  24. data/lib/souls/cli/delete/rspec_policy.rb +14 -0
  25. data/lib/souls/cli/delete/rspec_query.rb +14 -0
  26. data/lib/souls/cli/delete/rspec_resolver.rb +14 -0
  27. data/lib/souls/cli/delete/type.rb +14 -0
  28. data/lib/souls/cli/delete/type_rbs.rb +19 -0
  29. data/lib/souls/cli/generate/application.rb +0 -24
  30. data/lib/souls/cli/generate/type.rb +1 -4
  31. data/lib/souls/cli/index.rb +1 -0
  32. data/lib/souls/cli/upgrade/submodule.rb +1 -1
  33. data/lib/souls/cli.rb +4 -0
  34. data/lib/souls/version.rb +1 -1
  35. data/lib/souls/versions/.souls_api_version +1 -1
  36. data/lib/souls/versions/.souls_worker_version +1 -1
  37. metadata +29 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a000c6c2a80104c810c414e9543c093c9fd94657ccf00568849f334305c73f4
4
- data.tar.gz: 0dffafcbc0438b7c6a5cb79e631ca1627a83741f903f37dbac3c27c7d67df58a
3
+ metadata.gz: 6b61a64dda33348af32114cd6c7b6894b6cb98751b7989caebc381d10fd135ef
4
+ data.tar.gz: ef0ae0691b1b1f36c28b1ed550e5c1ee235e1ecd2aed12a29f15c0911a424810
5
5
  SHA512:
6
- metadata.gz: da117aac1d8a630f0b47710e7f3ce0e9b7e528db9752c9222182e859e2c6eb022cff3162184820b6752cebf5ec5cae8217a1ff5ec9e423b4a86b197c45982193
7
- data.tar.gz: 1ae9ab5899be91161b79a6dda11ac0f085aa98b8f9318ffbf9b43f0c6ea020d132379f835d2403d57e6d9cc309ef103441e7b4b4a3a270d429ec4db952c7180f
6
+ metadata.gz: f517555e97d304344a3f9af0b55bfcfc30f5ddf88e16be81110a9a1676cc3efa7a0b72c9cafd86700892e18da795d663d6f4675c1fa253e2a18cf1eb5f2f2298
7
+ data.tar.gz: 8c1887fdee4fc99e0bda89a85aae9221f0db583102f7ce8e56825510567d3ab7b51339be7c77db7979cb39b4a4064109f4b77acbf4d63b021fbd4130d0b234dc
@@ -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"
@@ -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.7".freeze
2
+ VERSION = "0.69.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.47.7
1
+ 0.48.0
@@ -1 +1 @@
1
- 0.47.7
1
+ 0.48.0
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.68.7
4
+ version: 0.69.0
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-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