souls 1.17.1 → 1.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/exe/souls +2 -2
  4. data/lib/souls/app/graphql/souls_connection.rb +2 -2
  5. data/lib/souls/app/graphql/souls_mutation.rb +5 -5
  6. data/lib/souls/app/graphql/souls_query.rb +2 -2
  7. data/lib/souls/app/graphql/types/base_argument.rb +1 -1
  8. data/lib/souls/app/graphql/types/base_enum.rb +1 -1
  9. data/lib/souls/app/graphql/types/base_field.rb +2 -2
  10. data/lib/souls/app/graphql/types/base_input_object.rb +2 -2
  11. data/lib/souls/app/graphql/types/base_interface.rb +2 -2
  12. data/lib/souls/app/graphql/types/base_object.rb +3 -3
  13. data/lib/souls/app/graphql/types/base_scalar.rb +1 -1
  14. data/lib/souls/app/graphql/types/base_union.rb +1 -1
  15. data/lib/souls/app/graphql/types/index.rb +1 -1
  16. data/lib/souls/app/index.rb +1 -1
  17. data/lib/souls/app/utils/painter.rb +1 -1
  18. data/lib/souls/app/utils/souls_logger.rb +3 -3
  19. data/lib/souls/cli/cli_exception.rb +1 -1
  20. data/lib/souls/cli/console/index.rb +1 -1
  21. data/lib/souls/cli/create/functions.rb +5 -5
  22. data/lib/souls/cli/create/index.rb +13 -13
  23. data/lib/souls/cli/db/create_migration.rb +5 -5
  24. data/lib/souls/cli/db/create_migration_rbs.rb +3 -3
  25. data/lib/souls/cli/db/index.rb +2 -2
  26. data/lib/souls/cli/db/model.rb +2 -2
  27. data/lib/souls/cli/db/model_rbs.rb +3 -3
  28. data/lib/souls/cli/db/rspec_model.rb +2 -2
  29. data/lib/souls/cli/delete/application.rb +3 -3
  30. data/lib/souls/cli/delete/connection.rb +2 -2
  31. data/lib/souls/cli/delete/connection_rbs.rb +3 -3
  32. data/lib/souls/cli/delete/edge.rb +2 -2
  33. data/lib/souls/cli/delete/edge_rbs.rb +3 -3
  34. data/lib/souls/cli/delete/index.rb +1 -1
  35. data/lib/souls/cli/delete/job.rb +4 -4
  36. data/lib/souls/cli/delete/job_rbs.rb +4 -4
  37. data/lib/souls/cli/delete/manager.rb +4 -4
  38. data/lib/souls/cli/delete/manager_rbs.rb +3 -3
  39. data/lib/souls/cli/delete/migration_file.rb +3 -3
  40. data/lib/souls/cli/delete/mutation.rb +3 -3
  41. data/lib/souls/cli/delete/mutation_rbs.rb +3 -3
  42. data/lib/souls/cli/delete/query.rb +2 -2
  43. data/lib/souls/cli/delete/query_rbs.rb +3 -3
  44. data/lib/souls/cli/delete/resolver.rb +2 -2
  45. data/lib/souls/cli/delete/resolver_rbs.rb +3 -3
  46. data/lib/souls/cli/delete/rspec_factory.rb +2 -2
  47. data/lib/souls/cli/delete/rspec_job.rb +2 -2
  48. data/lib/souls/cli/delete/rspec_manager.rb +2 -2
  49. data/lib/souls/cli/delete/rspec_mutation.rb +2 -2
  50. data/lib/souls/cli/delete/rspec_query.rb +2 -2
  51. data/lib/souls/cli/delete/rspec_resolver.rb +2 -2
  52. data/lib/souls/cli/delete/type.rb +2 -2
  53. data/lib/souls/cli/delete/type_rbs.rb +3 -3
  54. data/lib/souls/cli/docker/index.rb +1 -1
  55. data/lib/souls/cli/gcloud/compute/index.rb +24 -24
  56. data/lib/souls/cli/gcloud/functions/index.rb +18 -18
  57. data/lib/souls/cli/gcloud/iam/index.rb +12 -12
  58. data/lib/souls/cli/gcloud/index.rb +5 -5
  59. data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +3 -3
  60. data/lib/souls/cli/gcloud/pubsub/topics.rb +1 -1
  61. data/lib/souls/cli/gcloud/run/index.rb +1 -1
  62. data/lib/souls/cli/gcloud/scheduler/index.rb +4 -4
  63. data/lib/souls/cli/gcloud/sql/index.rb +17 -17
  64. data/lib/souls/cli/generate/application.rb +4 -4
  65. data/lib/souls/cli/generate/connection.rb +2 -2
  66. data/lib/souls/cli/generate/connection_rbs.rb +3 -3
  67. data/lib/souls/cli/generate/edge.rb +2 -2
  68. data/lib/souls/cli/generate/edge_rbs.rb +3 -3
  69. data/lib/souls/cli/generate/index.rb +1 -1
  70. data/lib/souls/cli/generate/job.rb +9 -9
  71. data/lib/souls/cli/generate/job_rbs.rb +4 -4
  72. data/lib/souls/cli/generate/manager.rb +4 -4
  73. data/lib/souls/cli/generate/manager_rbs.rb +3 -3
  74. data/lib/souls/cli/generate/mutation.rb +15 -15
  75. data/lib/souls/cli/generate/mutation_rbs.rb +17 -17
  76. data/lib/souls/cli/generate/query.rb +3 -3
  77. data/lib/souls/cli/generate/query_rbs.rb +3 -3
  78. data/lib/souls/cli/generate/resolver.rb +8 -8
  79. data/lib/souls/cli/generate/resolver_rbs.rb +3 -3
  80. data/lib/souls/cli/generate/rspec_factory.rb +4 -4
  81. data/lib/souls/cli/generate/rspec_job.rb +4 -4
  82. data/lib/souls/cli/generate/rspec_manager.rb +3 -3
  83. data/lib/souls/cli/generate/rspec_mutation.rb +9 -9
  84. data/lib/souls/cli/generate/rspec_query.rb +7 -7
  85. data/lib/souls/cli/generate/rspec_resolver.rb +7 -7
  86. data/lib/souls/cli/generate/type.rb +5 -5
  87. data/lib/souls/cli/generate/type_rbs.rb +6 -6
  88. data/lib/souls/cli/github/index.rb +13 -13
  89. data/lib/souls/cli/index.rb +1 -1
  90. data/lib/souls/cli/init/index.rb +8 -8
  91. data/lib/souls/cli/release/release.rb +8 -8
  92. data/lib/souls/cli/server/index.rb +2 -2
  93. data/lib/souls/cli/sync/conf.rb +8 -8
  94. data/lib/souls/cli/sync/model.rb +13 -11
  95. data/lib/souls/cli/sync/pubsub.rb +9 -9
  96. data/lib/souls/cli/update/index.rb +2 -2
  97. data/lib/souls/cli/update/mutation.rb +8 -8
  98. data/lib/souls/cli/update/mutation_rbs.rb +11 -11
  99. data/lib/souls/cli/update/resolver.rb +5 -5
  100. data/lib/souls/cli/update/rspec_factory.rb +4 -4
  101. data/lib/souls/cli/update/rspec_mutation.rb +5 -5
  102. data/lib/souls/cli/update/rspec_resolver.rb +4 -4
  103. data/lib/souls/cli/update/type.rb +4 -4
  104. data/lib/souls/cli/update/type_rbs.rb +5 -5
  105. data/lib/souls/cli/upgrade/config.rb +3 -3
  106. data/lib/souls/cli/upgrade/gemfile.rb +4 -4
  107. data/lib/souls/cli/upgrade/submodule.rb +1 -1
  108. data/lib/souls/cli.rb +5 -5
  109. data/lib/souls/index.rb +1 -1
  110. data/lib/souls/souls_path.rb +2 -2
  111. data/lib/souls/utils/index.rb +7 -7
  112. data/lib/souls/version.rb +2 -2
  113. data/lib/souls/versions/.souls_api_version +1 -1
  114. data/lib/souls/versions/.souls_worker_version +1 -1
  115. data/lib/souls.rb +2 -2
  116. metadata +1 -1
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Sql < Thor
3
3
  desc "create_instance", "Create Google Cloud SQL - PostgreSQL13"
4
4
  method_option :region, default: "", aliases: "--region", desc: "Google Cloud Platform Region"
@@ -6,10 +6,10 @@ module Souls
6
6
  def create_instance
7
7
  prompt = TTY::Prompt.new
8
8
  password = prompt.mask("Set DB PassWord:")
9
- app_name = Souls.configuration.app
10
- project_id = Souls.configuration.project_id
11
- instance_name = Souls.configuration.instance_name
12
- region = Souls.configuration.region if options[:region].blank?
9
+ app_name = SOULs.configuration.app
10
+ project_id = SOULs.configuration.project_id
11
+ instance_name = SOULs.configuration.instance_name
12
+ region = SOULs.configuration.region if options[:region].blank?
13
13
  db_type = options[:mysql] ? "MYSQL_8_0" : "POSTGRES_13"
14
14
 
15
15
  zone = "#{region}-b"
@@ -21,7 +21,7 @@ module Souls
21
21
  --root-password='#{password}' --database-flags cloudsql.iam_authentication=on"
22
22
  )
23
23
  instance_ip = `gcloud sql instances list | grep #{instance_name} | awk '{print $5}'`.strip
24
- Dir.chdir(Souls.get_api_path.to_s) do
24
+ Dir.chdir(SOULs.get_api_path.to_s) do
25
25
  file_path = ".env"
26
26
  File.open(file_path, "w") do |line|
27
27
  line.write(<<~TEXT)
@@ -35,7 +35,7 @@ module Souls
35
35
  TEXT
36
36
  end
37
37
  end
38
- Dir.chdir(Souls.get_mother_path.to_s) do
38
+ Dir.chdir(SOULs.get_mother_path.to_s) do
39
39
  file_path = ".env.production"
40
40
  File.open(file_path, "w") do |line|
41
41
  line.write(<<~TEXT)
@@ -51,7 +51,7 @@ module Souls
51
51
  TEXT
52
52
  end
53
53
  end
54
- Souls::Github.new.secret_set
54
+ SOULs::Github.new.secret_set
55
55
  Whirly.status = Paint["Cloud SQL #{instance_name} is successfully created! You can push to deploy!", :green]
56
56
  end
57
57
  true
@@ -71,16 +71,16 @@ module Souls
71
71
 
72
72
  desc "assign_network", "Assign Network"
73
73
  def assign_network
74
- app_name = Souls.configuration.app
75
- instance_name = Souls.configuration.instance_name
76
- project_id = Souls.configuration.project_id
74
+ app_name = SOULs.configuration.app
75
+ instance_name = SOULs.configuration.instance_name
76
+ project_id = SOULs.configuration.project_id
77
77
  system("gcloud beta sql instances patch #{instance_name} --project=#{project_id} --network=#{app_name}")
78
78
  end
79
79
 
80
80
  desc "create_ip_range", "Create VPC Adress Range"
81
81
  def create_ip_range
82
- app_name = Souls.configuration.app
83
- project_id = Souls.configuration.project_id
82
+ app_name = SOULs.configuration.app
83
+ project_id = SOULs.configuration.project_id
84
84
  system(
85
85
  "
86
86
  gcloud compute addresses create #{app_name}-ip-range \
@@ -95,8 +95,8 @@ module Souls
95
95
 
96
96
  desc "create_vpc_connector", "Create VPC-PEERING Connect"
97
97
  def create_vpc_connector
98
- app_name = Souls.configuration.app
99
- project_id = Souls.configuration.project_id
98
+ app_name = SOULs.configuration.app
99
+ project_id = SOULs.configuration.project_id
100
100
  system(
101
101
  "
102
102
  gcloud services vpc-peerings connect \
@@ -111,8 +111,8 @@ module Souls
111
111
  desc "assgin_ip", "Add Current Grobal IP to White List"
112
112
  method_option :ip, default: "", aliases: "--ip", desc: "Adding IP to Google Cloud SQL White List: e.g.'11.11.1.1'"
113
113
  def assign_ip
114
- project_id = Souls.configuration.project_id
115
- instance_name = Souls.configuration.instance_name
114
+ project_id = SOULs.configuration.project_id
115
+ instance_name = SOULs.configuration.instance_name
116
116
  ips = []
117
117
  ip =
118
118
  if options[:ip].blank?
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "scaffold [CLASS_NAME]", "Generate Scaffold from schema.rb"
4
4
  method_option :rbs, type: :boolean, aliases: "--rbs", default: false, desc: "Generates Only RBS Files"
@@ -16,11 +16,11 @@ module Souls
16
16
  method_option :rbs, type: :boolean, aliases: "--rbs", default: false, desc: "Generates Only RBS All Schema Files"
17
17
  def scaffold_all
18
18
  puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
19
- Souls.get_tables.each do |table|
19
+ SOULs.get_tables.each do |table|
20
20
  if options[:rbs]
21
- Souls::Generate.new.invoke(:scaffold, [table.singularize], { rbs: options[:rbs] })
21
+ SOULs::Generate.new.invoke(:scaffold, [table.singularize], { rbs: options[:rbs] })
22
22
  else
23
- Souls::Generate.new.invoke(:scaffold, [table.singularize], {})
23
+ SOULs::Generate.new.invoke(:scaffold, [table.singularize], {})
24
24
  end
25
25
  end
26
26
  true
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "connection [CLASS_NAME]", "Generate GraphQL Connection from schema.rb"
4
4
  def connection(class_name)
@@ -13,7 +13,7 @@ module Souls
13
13
  end
14
14
  TEXT
15
15
  end
16
- Souls::Painter.create_file(file_path.to_s)
16
+ SOULs::Painter.create_file(file_path.to_s)
17
17
  file_path
18
18
  end
19
19
  end
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "connection_rbs [CLASS_NAME]", "Generate GraphQL Connection RBS from schema.rb"
4
4
  def connection_rbs(class_name)
5
5
  file_path = ""
6
- Dir.chdir(Souls.get_mother_path.to_s) do
6
+ Dir.chdir(SOULs.get_mother_path.to_s) do
7
7
  file_dir = "./sig/api/app/graphql/types/connections/"
8
8
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
9
  singularized_class_name = class_name.underscore.singularize
@@ -17,7 +17,7 @@ module Souls
17
17
  end
18
18
  TEXT
19
19
  end
20
- Souls::Painter.create_file(file_path.to_s)
20
+ SOULs::Painter.create_file(file_path.to_s)
21
21
  end
22
22
  file_path
23
23
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "edge [CLASS_NAME]", "Generate GraphQL Edge from schema.rb"
4
4
  def edge(class_name)
@@ -13,7 +13,7 @@ module Souls
13
13
  end
14
14
  TEXT
15
15
  end
16
- Souls::Painter.create_file(file_path.to_s)
16
+ SOULs::Painter.create_file(file_path.to_s)
17
17
  file_path
18
18
  end
19
19
  end
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "edge_rbs [CLASS_NAME]", "Generate GraphQL Edge RBS from schema.rb"
4
4
  def edge_rbs(class_name)
5
5
  file_path = ""
6
- Dir.chdir(Souls.get_mother_path.to_s) do
6
+ Dir.chdir(SOULs.get_mother_path.to_s) do
7
7
  file_dir = "./sig/api/app/graphql/types/edges/"
8
8
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
9
  singularized_class_name = class_name.underscore.singularize
@@ -20,7 +20,7 @@ module Souls
20
20
  end
21
21
  TEXT
22
22
  end
23
- Souls::Painter.create_file(file_path.to_s)
23
+ SOULs::Painter.create_file(file_path.to_s)
24
24
  end
25
25
  file_path
26
26
  end
@@ -12,7 +12,7 @@ require_paths.each do |path|
12
12
  require_relative "./#{path}"
13
13
  end
14
14
 
15
- module Souls
15
+ module SOULs
16
16
  class Generate < Thor
17
17
  end
18
18
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "job [CLASS_NAME]", "Generate Job File in Worker"
4
4
  method_option :mailer, type: :boolean, aliases: "--mailer", default: false, desc: "Mailer Option"
@@ -10,8 +10,8 @@ module Souls
10
10
  create_job_type(class_name)
11
11
  create_job(class_name)
12
12
  end
13
- Souls::Generate.new.invoke(:job_rbs, [class_name], {})
14
- Souls::Generate.new.invoke(:rspec_job, [class_name], { mailer: options[:mailer] })
13
+ SOULs::Generate.new.invoke(:job_rbs, [class_name], {})
14
+ SOULs::Generate.new.invoke(:rspec_job, [class_name], { mailer: options[:mailer] })
15
15
  end
16
16
 
17
17
  private
@@ -37,7 +37,7 @@ module Souls
37
37
  end
38
38
  TEXT
39
39
  end
40
- Souls::Painter.create_file(file_path.to_s)
40
+ SOULs::Painter.create_file(file_path.to_s)
41
41
  file_path
42
42
  end
43
43
 
@@ -50,13 +50,13 @@ module Souls
50
50
  File.open(file_path, "w") do |f|
51
51
  f.write(<<~TEXT)
52
52
  module Types
53
- class #{class_name.camelize}Type < Souls::Types::BaseObject
53
+ class #{class_name.camelize}Type < SOULs::Types::BaseObject
54
54
  field :response, String, null: true
55
55
  end
56
56
  end
57
57
  TEXT
58
58
  end
59
- Souls::Painter.create_file(file_path.to_s)
59
+ SOULs::Painter.create_file(file_path.to_s)
60
60
  file_path
61
61
  end
62
62
 
@@ -95,7 +95,7 @@ module Souls
95
95
  end
96
96
  TEXT
97
97
  end
98
- Souls::Painter.create_file(file_path.to_s)
98
+ SOULs::Painter.create_file(file_path.to_s)
99
99
  file_path
100
100
  end
101
101
 
@@ -108,13 +108,13 @@ module Souls
108
108
  File.open(file_path, "w") do |f|
109
109
  f.write(<<~TEXT)
110
110
  module Types
111
- class #{class_name.camelize}Type < Souls::Types::BaseObject
111
+ class #{class_name.camelize}Type < SOULs::Types::BaseObject
112
112
  field :response, String, null: true
113
113
  end
114
114
  end
115
115
  TEXT
116
116
  end
117
- Souls::Painter.create_file(file_path.to_s)
117
+ SOULs::Painter.create_file(file_path.to_s)
118
118
  file_path
119
119
  end
120
120
  end
@@ -1,10 +1,10 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "job_rbs [CLASS_NAME]", "Generate SOULs Job Mutation RBS Template"
4
4
  def job_rbs(class_name)
5
5
  file_path = ""
6
6
  worker_name = FileUtils.pwd.split("/").last
7
- Dir.chdir(Souls.get_mother_path.to_s) do
7
+ Dir.chdir(SOULs.get_mother_path.to_s) do
8
8
  singularized_class_name = class_name.underscore.singularize
9
9
  file_dir = "./sig/#{worker_name}/app/graphql/queries/"
10
10
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
@@ -26,13 +26,13 @@ module Souls
26
26
  File.open(type_file_path, "w") do |f|
27
27
  f.write(<<~TEXT)
28
28
  module Types
29
- class #{singularized_class_name.camelize}Type < Souls::Types::BaseObject
29
+ class #{singularized_class_name.camelize}Type < SOULs::Types::BaseObject
30
30
  def self.field: (:response, String, null: true) -> untyped
31
31
  end
32
32
  end
33
33
  TEXT
34
34
  end
35
- Souls::Painter.create_file(file_path.to_s)
35
+ SOULs::Painter.create_file(file_path.to_s)
36
36
  end
37
37
  file_path
38
38
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "manager [MANAGER_NAME]", "Generate GraphQL Mutation Template"
4
4
  method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
@@ -10,8 +10,8 @@ module Souls
10
10
  end
11
11
 
12
12
  create_manager(class_name, options[:mutation])
13
- Souls::Generate.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
14
- Souls::Generate.new.invoke(:rspec_manager, [singularized_class_name], { mutation: options[:mutation] })
13
+ SOULs::Generate.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
14
+ SOULs::Generate.new.invoke(:rspec_manager, [singularized_class_name], { mutation: options[:mutation] })
15
15
  end
16
16
 
17
17
  private
@@ -44,7 +44,7 @@ module Souls
44
44
  end
45
45
  TEXT
46
46
  end
47
- Souls::Painter.create_file(file_path.to_s)
47
+ SOULs::Painter.create_file(file_path.to_s)
48
48
  file_path
49
49
  end
50
50
  end
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "manager_rbs [CLASS_NAME]", "Generate SOULs Manager RBS Template"
4
4
  method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
5
5
  def manager_rbs(class_name)
6
6
  file_path = ""
7
7
  singularized_class_name = class_name.underscore.singularize
8
- Dir.chdir(Souls.get_mother_path.to_s) do
8
+ Dir.chdir(SOULs.get_mother_path.to_s) do
9
9
  file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
10
10
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
11
11
  file_path = "#{file_dir}/#{options[:mutation]}.rbs"
@@ -23,7 +23,7 @@ module Souls
23
23
  end
24
24
  end
25
25
  TEXT
26
- Souls::Painter.create_file(file_path.to_s)
26
+ SOULs::Painter.create_file(file_path.to_s)
27
27
  end
28
28
  end
29
29
  file_path
@@ -1,10 +1,10 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "mutation [CLASS_NAME]", "Generate GraphQL Mutation from schema.rb"
4
4
  def mutation(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
 
7
- Dir.chdir(Souls.get_api_path.to_s) do
7
+ Dir.chdir(SOULs.get_api_path.to_s) do
8
8
  file_dir = "./app/graphql/mutations/base"
9
9
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
10
  file_path = "./app/graphql/mutations/base/#{singularized_class_name}/create_#{singularized_class_name}.rb"
@@ -26,7 +26,7 @@ module Souls
26
26
  file_path = "#{file_dir}/create_#{singularized_class_name}.rb"
27
27
  raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
28
28
 
29
- params = Souls.get_relation_params(class_name: singularized_class_name, col: "mutation")
29
+ params = SOULs.get_relation_params(class_name: singularized_class_name, col: "mutation")
30
30
  File.open(file_path, "a") do |f|
31
31
  f.write(<<~TEXT)
32
32
  module Mutations
@@ -40,7 +40,7 @@ module Souls
40
40
 
41
41
  File.open(file_path, "a") do |f|
42
42
  params[:params].each_with_index do |param, i|
43
- type = Souls.type_check(param[:type])
43
+ type = SOULs.type_check(param[:type])
44
44
  type = "[#{type}]" if param[:array]
45
45
  type = "String" if param[:column_name].match?(/$*_id\z/)
46
46
  next if param[:column_name] == "user_id"
@@ -60,7 +60,7 @@ module Souls
60
60
  params[:relation_params].each_with_index do |col, _i|
61
61
  next if col[:column_name] == "user_id"
62
62
 
63
- f.write(" _, #{col[:column_name]} = SoulsApiSchema.from_global_id(args[:#{col[:column_name]}])\n")
63
+ f.write(" _, #{col[:column_name]} = SOULsApiSchema.from_global_id(args[:#{col[:column_name]}])\n")
64
64
  end
65
65
  relation_params =
66
66
  params[:relation_params].map do |n|
@@ -83,7 +83,7 @@ module Souls
83
83
  end
84
84
  TEXT
85
85
  end
86
- Souls::Painter.create_file(file_path.to_s)
86
+ SOULs::Painter.create_file(file_path.to_s)
87
87
  file_path
88
88
  end
89
89
 
@@ -94,7 +94,7 @@ module Souls
94
94
  file_path = "#{file_dir}/update_#{singularized_class_name}.rb"
95
95
  raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
96
96
 
97
- params = Souls.get_relation_params(class_name: singularized_class_name, col: "mutation")
97
+ params = SOULs.get_relation_params(class_name: singularized_class_name, col: "mutation")
98
98
  File.open(file_path, "w") do |f|
99
99
  f.write(<<~TEXT)
100
100
  module Mutations
@@ -109,7 +109,7 @@ module Souls
109
109
 
110
110
  File.open(file_path, "a") do |f|
111
111
  params[:params].each_with_index do |param, i|
112
- type = Souls.type_check(param[:type])
112
+ type = SOULs.type_check(param[:type])
113
113
  type = "[#{type}]" if param[:array]
114
114
  type = "String" if param[:column_name].match?(/$*_id\z/)
115
115
  next if param[:column_name] == "user_id"
@@ -117,7 +117,7 @@ module Souls
117
117
  if i == params[:params].size - 1
118
118
  f.write(" argument :#{param[:column_name]}, #{type}, required: false\n\n")
119
119
  f.write(" def resolve(args)\n")
120
- f.write(" _, data_id = SoulsApiSchema.from_global_id(args[:id])\n")
120
+ f.write(" _, data_id = SOULsApiSchema.from_global_id(args[:id])\n")
121
121
  else
122
122
  f.write(" argument :#{param[:column_name]}, #{type}, required: false\n")
123
123
  end
@@ -130,7 +130,7 @@ module Souls
130
130
  params[:relation_params].each_with_index do |col, _i|
131
131
  next if col[:column_name] == "user_id"
132
132
 
133
- f.write(" _, #{col[:column_name]} = SoulsApiSchema.from_global_id(args[:#{col[:column_name]}])\n")
133
+ f.write(" _, #{col[:column_name]} = SOULsApiSchema.from_global_id(args[:#{col[:column_name]}])\n")
134
134
  end
135
135
  relation_params =
136
136
  params[:relation_params].map do |n|
@@ -155,7 +155,7 @@ module Souls
155
155
  end
156
156
  TEXT
157
157
  end
158
- Souls::Painter.create_file(file_path.to_s)
158
+ SOULs::Painter.create_file(file_path.to_s)
159
159
  file_path
160
160
  end
161
161
 
@@ -173,7 +173,7 @@ module Souls
173
173
  argument :id, String, required: true
174
174
 
175
175
  def resolve args
176
- _, data_id = SoulsApiSchema.from_global_id args[:id]
176
+ _, data_id = SOULsApiSchema.from_global_id args[:id]
177
177
  #{class_name} = ::#{class_name.camelize}.find data_id
178
178
  #{class_name}.update(is_deleted: true)
179
179
  { #{class_name}: ::#{class_name.camelize}.find(data_id) }
@@ -183,7 +183,7 @@ module Souls
183
183
  end
184
184
  TEXT
185
185
  end
186
- Souls::Painter.create_file(file_path.to_s)
186
+ SOULs::Painter.create_file(file_path.to_s)
187
187
  file_path
188
188
  end
189
189
 
@@ -201,7 +201,7 @@ module Souls
201
201
  argument :id, String, required: true
202
202
 
203
203
  def resolve args
204
- _, data_id = SoulsApiSchema.from_global_id args[:id]
204
+ _, data_id = SOULsApiSchema.from_global_id args[:id]
205
205
  #{class_name} = ::#{class_name.camelize}.find data_id
206
206
  #{class_name}.destroy
207
207
  { #{class_name}: #{class_name} }
@@ -211,7 +211,7 @@ module Souls
211
211
  end
212
212
  TEXT
213
213
  end
214
- Souls::Painter.create_file(file_path.to_s)
214
+ SOULs::Painter.create_file(file_path.to_s)
215
215
  file_path
216
216
  rescue StandardError => e
217
217
  puts(e)
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "mutation_rbs [CLASS_NAME]", "Generate GraphQL Mutation RBS from schema.rb"
4
4
  def mutation_rbs(class_name)
@@ -13,13 +13,13 @@ module Souls
13
13
 
14
14
  def create_rbs_mutation(class_name: "user")
15
15
  file_path = ""
16
- Dir.chdir(Souls.get_mother_path.to_s) do
16
+ Dir.chdir(SOULs.get_mother_path.to_s) do
17
17
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
18
18
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
19
19
  file_path = "#{file_dir}/create_#{class_name}.rbs"
20
20
  raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
21
21
 
22
- params = Souls.get_relation_params(class_name: class_name, col: "mutation")
22
+ params = SOULs.get_relation_params(class_name: class_name, col: "mutation")
23
23
  File.open(file_path, "w") do |f|
24
24
  f.write(<<~TEXT)
25
25
  class Boolean
@@ -36,7 +36,7 @@ module Souls
36
36
  end
37
37
  File.open(file_path, "a") do |f|
38
38
  params[:params].each_with_index do |param, i|
39
- type = Souls.rbs_type_check(param[:type])
39
+ type = SOULs.rbs_type_check(param[:type])
40
40
  type = "[#{type}]" if param[:array]
41
41
  if i == params[:params].size - 1
42
42
  f.write(" #{param[:column_name]}: #{type}?\n")
@@ -55,8 +55,8 @@ module Souls
55
55
 
56
56
  File.open(file_path, "a") do |f|
57
57
  params[:params].each_with_index do |param, i|
58
- type = Souls.type_check(param[:type])
59
- rbs_type = Souls.rbs_type_check(param[:type])
58
+ type = SOULs.type_check(param[:type])
59
+ rbs_type = SOULs.rbs_type_check(param[:type])
60
60
  type = "[#{type}]" if param[:array]
61
61
  if i.zero?
62
62
  if param[:column_name].match?(/$*_id\z/)
@@ -97,17 +97,17 @@ module Souls
97
97
  TEXT
98
98
  end
99
99
  end
100
- Souls::Painter.create_file(file_path.to_s)
100
+ SOULs::Painter.create_file(file_path.to_s)
101
101
  file_path
102
102
  end
103
103
 
104
104
  def update_rbs_mutation(class_name: "user")
105
105
  file_path = ""
106
- Dir.chdir(Souls.get_mother_path.to_s) do
106
+ Dir.chdir(SOULs.get_mother_path.to_s) do
107
107
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
108
108
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
109
109
  file_path = "#{file_dir}/update_#{class_name}.rbs"
110
- params = Souls.get_relation_params(class_name: class_name, col: "mutation")
110
+ params = SOULs.get_relation_params(class_name: class_name, col: "mutation")
111
111
  params[:params] << { column_name: "id", type: "string", array: false }
112
112
  File.open(file_path, "w") do |f|
113
113
  f.write(<<~TEXT)
@@ -125,7 +125,7 @@ module Souls
125
125
  File.open(file_path, "a") do |f|
126
126
  cols = params[:params].reject { |n| n[:column_name] == "user_id" }
127
127
  cols.each_with_index do |param, i|
128
- type = Souls.rbs_type_check(param[:type])
128
+ type = SOULs.rbs_type_check(param[:type])
129
129
  type = "[#{type}]" if param[:array]
130
130
  type = "String" if param[:column_name].match?(/$*_id\z/)
131
131
 
@@ -145,8 +145,8 @@ module Souls
145
145
  File.open(file_path, "a") do |f|
146
146
  cols = params[:params].reject { |n| n[:column_name] == "user_id" }
147
147
  cols.each_with_index do |param, i|
148
- type = Souls.type_check(param[:type])
149
- rbs_type = Souls.rbs_type_check(param[:type])
148
+ type = SOULs.type_check(param[:type])
149
+ rbs_type = SOULs.rbs_type_check(param[:type])
150
150
  type = "[#{type}]" if param[:array]
151
151
  type = "String" if param[:column_name].match?(/$*_id\z/)
152
152
  rbs_type = "String" if param[:column_name].match?(/$*_id\z/)
@@ -176,13 +176,13 @@ module Souls
176
176
  TEXT
177
177
  end
178
178
  end
179
- Souls::Painter.create_file(file_path.to_s)
179
+ SOULs::Painter.create_file(file_path.to_s)
180
180
  file_path
181
181
  end
182
182
 
183
183
  def delete_rbs_mutation(class_name: "user")
184
184
  file_path = ""
185
- Dir.chdir(Souls.get_mother_path.to_s) do
185
+ Dir.chdir(SOULs.get_mother_path.to_s) do
186
186
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
187
187
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
188
188
  file_path = "#{file_dir}/delete_#{class_name}.rbs"
@@ -204,14 +204,14 @@ module Souls
204
204
  end
205
205
  TEXT
206
206
  end
207
- Souls::Painter.create_file(file_path.to_s)
207
+ SOULs::Painter.create_file(file_path.to_s)
208
208
  end
209
209
  file_path
210
210
  end
211
211
 
212
212
  def destroy_delete_rbs_mutation(class_name: "user")
213
213
  file_path = ""
214
- Dir.chdir(Souls.get_mother_path.to_s) do
214
+ Dir.chdir(SOULs.get_mother_path.to_s) do
215
215
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
216
216
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
217
217
  file_path = "#{file_dir}/destroy_delete_#{class_name}.rbs"
@@ -233,7 +233,7 @@ module Souls
233
233
  end
234
234
  TEXT
235
235
  end
236
- Souls::Painter.create_file(file_path.to_s)
236
+ SOULs::Painter.create_file(file_path.to_s)
237
237
  end
238
238
  file_path
239
239
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "query [CLASS_NAME]", "Generate GraphQL Query from schema.rb"
4
4
  def query(class_name)
@@ -22,13 +22,13 @@ module Souls
22
22
  argument :id, String, required: true
23
23
 
24
24
  def resolve args
25
- _, data_id = SoulsApiSchema.from_global_id args[:id]
25
+ _, data_id = SOULsApiSchema.from_global_id args[:id]
26
26
  ::#{class_name.camelize}.find(data_id)
27
27
  end
28
28
  end
29
29
  end
30
30
  TEXT
31
- Souls::Painter.create_file(file_path.to_s)
31
+ SOULs::Painter.create_file(file_path.to_s)
32
32
  file_path
33
33
  rescue StandardError => e
34
34
  raise(StandardError, e)
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Generate < Thor
3
3
  desc "query_rbs [CLASS_NAME]", "Generate GraphQL Query RBS"
4
4
  def query_rbs(class_name)
@@ -9,7 +9,7 @@ module Souls
9
9
 
10
10
  def single_query_rbs(class_name)
11
11
  file_path = ""
12
- Dir.chdir(Souls.get_mother_path.to_s) do
12
+ Dir.chdir(SOULs.get_mother_path.to_s) do
13
13
  file_dir = "./sig/api/app/graphql/queries/"
14
14
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
15
15
  singularized_class_name = class_name.underscore.singularize
@@ -30,7 +30,7 @@ module Souls
30
30
  end
31
31
  TEXT
32
32
  end
33
- Souls::Painter.create_file(file_path.to_s)
33
+ SOULs::Painter.create_file(file_path.to_s)
34
34
  end
35
35
  file_path
36
36
  end