souls 1.17.2 → 1.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) 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 +21 -12
  6. data/lib/souls/app/graphql/souls_query.rb +11 -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 +14 -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/graphql/types/mutation_object.rb +29 -0
  17. data/lib/souls/app/graphql/types/query_object.rb +16 -0
  18. data/lib/souls/app/index.rb +1 -1
  19. data/lib/souls/app/utils/painter.rb +1 -1
  20. data/lib/souls/app/utils/souls_logger.rb +3 -3
  21. data/lib/souls/cli/cli_exception.rb +1 -1
  22. data/lib/souls/cli/console/index.rb +1 -1
  23. data/lib/souls/cli/create/functions.rb +5 -5
  24. data/lib/souls/cli/create/index.rb +13 -13
  25. data/lib/souls/cli/db/create_migration.rb +5 -5
  26. data/lib/souls/cli/db/create_migration_rbs.rb +3 -3
  27. data/lib/souls/cli/db/index.rb +2 -2
  28. data/lib/souls/cli/db/model.rb +2 -2
  29. data/lib/souls/cli/db/model_rbs.rb +3 -3
  30. data/lib/souls/cli/db/rspec_model.rb +2 -2
  31. data/lib/souls/cli/delete/application.rb +3 -3
  32. data/lib/souls/cli/delete/connection.rb +2 -2
  33. data/lib/souls/cli/delete/connection_rbs.rb +3 -3
  34. data/lib/souls/cli/delete/edge.rb +2 -2
  35. data/lib/souls/cli/delete/edge_rbs.rb +3 -3
  36. data/lib/souls/cli/delete/index.rb +1 -1
  37. data/lib/souls/cli/delete/job.rb +4 -4
  38. data/lib/souls/cli/delete/job_rbs.rb +4 -4
  39. data/lib/souls/cli/delete/manager.rb +4 -4
  40. data/lib/souls/cli/delete/manager_rbs.rb +3 -3
  41. data/lib/souls/cli/delete/migration_file.rb +3 -3
  42. data/lib/souls/cli/delete/mutation.rb +3 -3
  43. data/lib/souls/cli/delete/mutation_rbs.rb +3 -3
  44. data/lib/souls/cli/delete/query.rb +2 -2
  45. data/lib/souls/cli/delete/query_rbs.rb +3 -3
  46. data/lib/souls/cli/delete/resolver.rb +2 -2
  47. data/lib/souls/cli/delete/resolver_rbs.rb +3 -3
  48. data/lib/souls/cli/delete/rspec_factory.rb +2 -2
  49. data/lib/souls/cli/delete/rspec_job.rb +2 -2
  50. data/lib/souls/cli/delete/rspec_manager.rb +2 -2
  51. data/lib/souls/cli/delete/rspec_mutation.rb +2 -2
  52. data/lib/souls/cli/delete/rspec_query.rb +2 -2
  53. data/lib/souls/cli/delete/rspec_resolver.rb +2 -2
  54. data/lib/souls/cli/delete/type.rb +2 -2
  55. data/lib/souls/cli/delete/type_rbs.rb +3 -3
  56. data/lib/souls/cli/docker/index.rb +1 -1
  57. data/lib/souls/cli/gcloud/compute/index.rb +24 -24
  58. data/lib/souls/cli/gcloud/functions/index.rb +18 -18
  59. data/lib/souls/cli/gcloud/iam/index.rb +12 -12
  60. data/lib/souls/cli/gcloud/index.rb +5 -5
  61. data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +3 -3
  62. data/lib/souls/cli/gcloud/pubsub/topics.rb +1 -1
  63. data/lib/souls/cli/gcloud/run/index.rb +1 -1
  64. data/lib/souls/cli/gcloud/scheduler/index.rb +4 -4
  65. data/lib/souls/cli/gcloud/sql/index.rb +17 -17
  66. data/lib/souls/cli/generate/application.rb +4 -4
  67. data/lib/souls/cli/generate/connection.rb +2 -2
  68. data/lib/souls/cli/generate/connection_rbs.rb +3 -3
  69. data/lib/souls/cli/generate/edge.rb +2 -2
  70. data/lib/souls/cli/generate/edge_rbs.rb +3 -3
  71. data/lib/souls/cli/generate/index.rb +1 -1
  72. data/lib/souls/cli/generate/job.rb +9 -9
  73. data/lib/souls/cli/generate/job_rbs.rb +4 -4
  74. data/lib/souls/cli/generate/manager.rb +4 -4
  75. data/lib/souls/cli/generate/manager_rbs.rb +3 -3
  76. data/lib/souls/cli/generate/mutation.rb +15 -15
  77. data/lib/souls/cli/generate/mutation_rbs.rb +17 -17
  78. data/lib/souls/cli/generate/query.rb +3 -3
  79. data/lib/souls/cli/generate/query_rbs.rb +3 -3
  80. data/lib/souls/cli/generate/resolver.rb +8 -8
  81. data/lib/souls/cli/generate/resolver_rbs.rb +3 -3
  82. data/lib/souls/cli/generate/rspec_factory.rb +4 -4
  83. data/lib/souls/cli/generate/rspec_job.rb +4 -4
  84. data/lib/souls/cli/generate/rspec_manager.rb +3 -3
  85. data/lib/souls/cli/generate/rspec_mutation.rb +9 -9
  86. data/lib/souls/cli/generate/rspec_query.rb +7 -7
  87. data/lib/souls/cli/generate/rspec_resolver.rb +7 -7
  88. data/lib/souls/cli/generate/type.rb +5 -5
  89. data/lib/souls/cli/generate/type_rbs.rb +6 -6
  90. data/lib/souls/cli/github/index.rb +13 -13
  91. data/lib/souls/cli/index.rb +1 -1
  92. data/lib/souls/cli/init/index.rb +8 -8
  93. data/lib/souls/cli/release/release.rb +8 -8
  94. data/lib/souls/cli/server/index.rb +2 -2
  95. data/lib/souls/cli/sync/conf.rb +8 -8
  96. data/lib/souls/cli/sync/model.rb +13 -11
  97. data/lib/souls/cli/sync/pubsub.rb +9 -9
  98. data/lib/souls/cli/update/index.rb +2 -2
  99. data/lib/souls/cli/update/mutation.rb +8 -8
  100. data/lib/souls/cli/update/mutation_rbs.rb +11 -11
  101. data/lib/souls/cli/update/resolver.rb +5 -5
  102. data/lib/souls/cli/update/rspec_factory.rb +4 -4
  103. data/lib/souls/cli/update/rspec_mutation.rb +5 -5
  104. data/lib/souls/cli/update/rspec_resolver.rb +4 -4
  105. data/lib/souls/cli/update/type.rb +4 -4
  106. data/lib/souls/cli/update/type_rbs.rb +5 -5
  107. data/lib/souls/cli/upgrade/config.rb +3 -3
  108. data/lib/souls/cli/upgrade/gemfile.rb +4 -4
  109. data/lib/souls/cli/upgrade/submodule.rb +1 -1
  110. data/lib/souls/cli.rb +5 -5
  111. data/lib/souls/index.rb +1 -1
  112. data/lib/souls/souls_path.rb +2 -2
  113. data/lib/souls/utils/index.rb +7 -7
  114. data/lib/souls/version.rb +2 -2
  115. data/lib/souls/versions/.souls_api_version +1 -1
  116. data/lib/souls/versions/.souls_worker_version +1 -1
  117. data/lib/souls.rb +2 -2
  118. metadata +3 -1
@@ -1,10 +1,10 @@
1
- module Souls
1
+ module SOULs
2
2
  class CLI < Thor
3
3
  desc "server", "Run SOULs APP"
4
4
  method_option :all, type: :boolean, alias: "--all", default: false, desc: "Run All API & Workers"
5
5
  def server
6
6
  if options[:all]
7
- Dir.chdir(Souls.get_mother_path.to_s) do
7
+ Dir.chdir(SOULs.get_mother_path.to_s) do
8
8
  front_path = "apps/console/package.json"
9
9
  system("foreman start -f Procfile.dev")
10
10
  system("cd apps/console && yarn dev") if File.exist?(front_path)
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Sync < Thor
3
3
  desc "conf", "Sync config/souls.rb Endpoint with Google Cloud Run"
4
4
  def conf
5
- Souls::Gcloud.new.config_set
5
+ SOULs::Gcloud.new.config_set
6
6
  update_conf
7
7
  update_conf(strain: "api")
8
- Souls::Painter.sync("`config/souls.rb`, `apps/api/config/souls.rb`")
8
+ SOULs::Painter.sync("`config/souls.rb`, `apps/api/config/souls.rb`")
9
9
  end
10
10
 
11
11
  # rubocop:disable Style/StringHashKeys
@@ -15,9 +15,9 @@ module Souls
15
15
  private
16
16
 
17
17
  def update_conf(strain: "mother")
18
- require("#{Souls.get_mother_path}/config/souls")
19
- workers = Souls.configuration.workers
20
- Dir.chdir(Souls.get_mother_path.to_s) do
18
+ require("#{SOULs.get_mother_path}/config/souls")
19
+ workers = SOULs.configuration.workers
20
+ Dir.chdir(SOULs.get_mother_path.to_s) do
21
21
  file_path = strain == "mother" ? "config/souls.rb" : "apps/api/config/souls.rb"
22
22
  new_file_path = "souls.rb"
23
23
  worker_switch = false
@@ -33,8 +33,8 @@ module Souls
33
33
 
34
34
  new_line.write(" config.workers = [\n")
35
35
  workers.each_with_index do |worker, i|
36
- base_url = Souls::CloudRun.new.get_endpoint(worker_name: worker[:name])
37
- endpoint = Souls.configuration.endpoint
36
+ base_url = SOULs::CloudRun.new.get_endpoint(worker_name: worker[:name])
37
+ endpoint = SOULs.configuration.endpoint
38
38
  if (i + 1) == workers.size
39
39
  new_line.write(<<-TEXT)
40
40
  {
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Sync < Thor
3
3
  # rubocop:disable Style/StringHashKeys
4
4
  map "models" => :model
@@ -11,33 +11,35 @@ module Souls
11
11
  cp_and_dl_files(dir: dir)
12
12
  cp_env_files
13
13
  end
14
- Souls::Painter.sync(cp_dir.to_s)
14
+ SOULs::Painter.sync(cp_dir.to_s)
15
15
  end
16
16
 
17
17
  private
18
18
 
19
19
  def cp_and_dl_files(dir: "db")
20
- require("#{Souls.get_mother_path}/config/souls")
21
- worker_paths = Souls.configuration.workers.map { |n| n[:name].split("-").last }
20
+ require("#{SOULs.get_mother_path}/config/souls")
21
+ project_id = SOULs.configuration.project_id
22
+ worker_paths = SOULs.configuration.workers.map { |n| n[:name].split("souls-#{project_id}-").last }
22
23
  worker_paths.each do |path|
23
24
  cp_path = "./apps/api/#{dir}"
24
25
  old_path = "./apps/#{path}/#{dir}"
25
26
 
26
- system("rm -rf #{old_path}", chdir: Souls.get_mother_path)
27
- system("mkdir -p #{old_path}", chdir: Souls.get_mother_path)
28
- system("cp -r #{cp_path}/* #{old_path}", chdir: Souls.get_mother_path)
27
+ system("rm -rf #{old_path}", chdir: SOULs.get_mother_path)
28
+ system("mkdir -p #{old_path}", chdir: SOULs.get_mother_path)
29
+ system("cp -r #{cp_path}/* #{old_path}", chdir: SOULs.get_mother_path)
29
30
  rescue StandardError
30
31
  # Do nothing
31
32
  end
32
33
  end
33
34
 
34
35
  def cp_env_files
35
- return unless File.exist?("#{Souls.get_mother_path}/apps/api/.env")
36
+ return unless File.exist?("#{SOULs.get_mother_path}/apps/api/.env")
36
37
 
37
- worker_paths = Souls.configuration.workers.map { |n| n[:name].split("-").last }
38
+ project_id = SOULs.configuration.project_id
39
+ worker_paths = SOULs.configuration.workers.map { |n| n[:name].split("souls-#{project_id}-").last }
38
40
  worker_paths.each do |path|
39
- system("rm -f ./apps/#{path}/.env", chdir: Souls.get_mother_path)
40
- system("cp -f ./apps/api/.env ./apps/#{path}/.env", chdir: Souls.get_mother_path)
41
+ system("rm -f ./apps/#{path}/.env", chdir: SOULs.get_mother_path)
42
+ system("cp -f ./apps/api/.env ./apps/#{path}/.env", chdir: SOULs.get_mother_path)
41
43
  end
42
44
  end
43
45
  end
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Sync < Thor
3
3
  desc "pubsub", "Sync Worker Jobs & Google Cloud Pubsub Topics/Subscriptions"
4
4
  def pubsub
5
5
  worker_name = FileUtils.pwd.split("/").last
6
6
 
7
7
  unless worker_name.match(/^worker-(\d|\w)+(-)*(\d|\w)+$/)
8
- Souls::Painter.error("You are at wrong dir!\nPlease go to worker-* dir!")
8
+ SOULs::Painter.error("You are at wrong dir!\nPlease go to worker-* dir!")
9
9
  return false
10
10
  end
11
11
 
@@ -16,13 +16,13 @@ module Souls
16
16
  return false if worker_file_names.blank?
17
17
 
18
18
  sync_pubsub_topics_and_subscriptions(workers: worker_file_names, worker_url: url)
19
- Souls::Painter.sync("All Jobs with PubSub Subscription!")
19
+ SOULs::Painter.sync("All Jobs with PubSub Subscription!")
20
20
  end
21
21
 
22
22
  private
23
23
 
24
24
  def sync_pubsub_topics_and_subscriptions(worker_url:, workers: {})
25
- project_id = Souls.configuration.project_id
25
+ project_id = SOULs.configuration.project_id
26
26
  pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
27
27
  topics = pubsub.topics
28
28
  worker_name = FileUtils.pwd.split("/").last
@@ -52,14 +52,14 @@ module Souls
52
52
  end
53
53
 
54
54
  def create_topic(topic_id: "worker-mailer")
55
- project_id = Souls.configuration.project_id
55
+ project_id = SOULs.configuration.project_id
56
56
  pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
57
57
  topic = pubsub.create_topic(topic_id.to_s)
58
58
  puts("Topic #{topic.name} created.")
59
59
  end
60
60
 
61
61
  def delete_topic(topic_id: "worker-mailer")
62
- project_id = Souls.configuration.project_id
62
+ project_id = SOULs.configuration.project_id
63
63
  pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
64
64
  topic = pubsub.topic(topic_id.to_s)
65
65
  topic.delete
@@ -67,7 +67,7 @@ module Souls
67
67
  end
68
68
 
69
69
  def delete_subscription(topic_id: "worker-mailer")
70
- project_id = Souls.configuration.project_id
70
+ project_id = SOULs.configuration.project_id
71
71
  pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
72
72
  subscription_id = "#{topic_id}-sub"
73
73
  subscription = pubsub.subscription(subscription_id)
@@ -75,11 +75,11 @@ module Souls
75
75
  end
76
76
 
77
77
  def create_push_subscription(worker_url:, topic_id: "worker-mailer")
78
- souls_endpoint = Souls.configuration.endpoint
78
+ souls_endpoint = SOULs.configuration.endpoint
79
79
  subscription_id = "#{topic_id}-sub"
80
80
  endpoint = "#{worker_url}/#{souls_endpoint}"
81
81
 
82
- project_id = Souls.configuration.project_id
82
+ project_id = SOULs.configuration.project_id
83
83
  pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
84
84
 
85
85
  topic = pubsub.topic(topic_id)
@@ -7,7 +7,7 @@ require_relative "./rspec_factory"
7
7
  require_relative "./rspec_mutation"
8
8
  require_relative "./rspec_resolver"
9
9
 
10
- module Souls
10
+ module SOULs
11
11
  class Update < Thor
12
12
  desc "scaffold [CLASS_NAME]", "Update Scaffold Params"
13
13
  def scaffold(class_name)
@@ -18,7 +18,7 @@ module Souls
18
18
  rspec_factory(class_name)
19
19
  rspec_mutation(class_name)
20
20
  rspec_resolver(class_name)
21
- Dir.chdir(Souls.get_mother_path.to_s) do
21
+ Dir.chdir(SOULs.get_mother_path.to_s) do
22
22
  create_mutation_rbs(class_name)
23
23
  update_mutation_rbs(class_name)
24
24
  type_rbs(class_name)
@@ -1,38 +1,38 @@
1
1
  require_relative "../cli_exception"
2
2
 
3
- module Souls
3
+ module SOULs
4
4
  class Update < Thor
5
5
  desc "create_mutation [CLASS_NAME]", "Update GraphQL Type from schema.rb"
6
6
  def create_mutation(class_name)
7
7
  singularized_class_name = class_name.singularize.underscore
8
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
8
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
9
9
  dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
10
10
  file_path = "#{dir_name}/create_#{singularized_class_name}.rb"
11
11
  unless File.exist?(file_path)
12
- Souls::Painter.error("File #{file_path} is missing. Please recreate it and then run this command again.")
12
+ SOULs::Painter.error("File #{file_path} is missing. Please recreate it and then run this command again.")
13
13
  return
14
14
  end
15
15
 
16
16
  mutation_argument = check_mutation_argument(class_name: "user", action: "create")
17
17
  overwrite_class_file(mutation_argument: mutation_argument, file_path: file_path, new_cols: new_cols)
18
- Souls::Painter.update_file(file_path.to_s)
18
+ SOULs::Painter.update_file(file_path.to_s)
19
19
  end
20
20
 
21
21
  desc "update_mutation [CLASS_NAME]", "Update GraphQL Type from schema.rb"
22
22
  def update_mutation(class_name)
23
23
  singularized_class_name = class_name.singularize.underscore
24
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
24
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
25
25
  dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
26
26
  file_path = "#{dir_name}/update_#{singularized_class_name}.rb"
27
27
  unless File.exist?(file_path)
28
- Souls::Painter.error("File #{file_path} is missing. Please recreate it and then run this command again.")
28
+ SOULs::Painter.error("File #{file_path} is missing. Please recreate it and then run this command again.")
29
29
  return
30
30
  end
31
31
 
32
32
  mutation_argument = check_mutation_argument(class_name: class_name, action: "update")
33
33
  overwrite_class_file(mutation_argument: mutation_argument, file_path: file_path, new_cols: new_cols)
34
34
 
35
- Souls::Painter.update_file(file_path.to_s)
35
+ SOULs::Painter.update_file(file_path.to_s)
36
36
  end
37
37
 
38
38
  private
@@ -46,7 +46,7 @@ module Souls
46
46
 
47
47
  until new_cols.empty?
48
48
  col = new_cols.pop
49
- type = Souls.type_check(col[:type])
49
+ type = SOULs.type_check(col[:type])
50
50
  type = "[#{type}]" if col[:array]
51
51
  args = mutation_argument
52
52
  next if args.include?(col[:column_name])
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Update < Thor
3
3
  desc "create_mutation_rbs [CLASS_NAME]", "Update GraphQL Type from schema.rb"
4
4
  def create_mutation_rbs(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
6
  new_cols = ""
7
- Dir.chdir(Souls.get_api_path.to_s) do
8
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
7
+ Dir.chdir(SOULs.get_api_path.to_s) do
8
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
9
9
  end
10
10
  dir_name = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
11
11
  file_path = "#{dir_name}/create_#{singularized_class_name}.rbs"
@@ -23,7 +23,7 @@ module Souls
23
23
  next
24
24
  elsif line.include?("def resolve:") && !resolve
25
25
  new_cols.each_with_index do |col, i|
26
- type = Souls.type_check(col[:type])
26
+ type = SOULs.type_check(col[:type])
27
27
  type = "[#{type}]" if col[:array]
28
28
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
29
29
 
@@ -37,7 +37,7 @@ module Souls
37
37
  resolve = true
38
38
  elsif line.include?("def self.argument:") && !argument
39
39
  new_cols.each_with_index do |col, i|
40
- type = Souls.type_check(col[:type])
40
+ type = SOULs.type_check(col[:type])
41
41
  type = "[#{type}]" if col[:array]
42
42
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
43
43
 
@@ -56,15 +56,15 @@ module Souls
56
56
  end
57
57
  end
58
58
  File.open(file_path, "w") { |f| f.write(write_txt) }
59
- Souls::Painter.update_file(file_path.to_s)
59
+ SOULs::Painter.update_file(file_path.to_s)
60
60
  end
61
61
 
62
62
  desc "update_mutation [CLASS_NAME]", "Update GraphQL Type from schema.rb"
63
63
  def update_mutation_rbs(class_name)
64
64
  singularized_class_name = class_name.singularize.underscore
65
65
  new_cols = ""
66
- Dir.chdir(Souls.get_api_path.to_s) do
67
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
66
+ Dir.chdir(SOULs.get_api_path.to_s) do
67
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
68
68
  end
69
69
  dir_name = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
70
70
  new_file_path = "config/update_mutation.rbs"
@@ -83,7 +83,7 @@ module Souls
83
83
  next
84
84
  elsif line.include?("def resolve:") && !resolve
85
85
  new_cols.each_with_index do |col, i|
86
- type = Souls.type_check(col[:type])
86
+ type = SOULs.type_check(col[:type])
87
87
  type = "[#{type}]" if col[:array]
88
88
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
89
89
 
@@ -97,7 +97,7 @@ module Souls
97
97
  resolve = true
98
98
  elsif line.include?("def self.argument:") && !argument
99
99
  new_cols.each_with_index do |col, i|
100
- type = Souls.type_check(col[:type])
100
+ type = SOULs.type_check(col[:type])
101
101
  type = "[#{type}]" if col[:array]
102
102
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
103
103
 
@@ -120,7 +120,7 @@ module Souls
120
120
  end
121
121
  FileUtils.rm(file_path)
122
122
  FileUtils.mv(new_file_path, file_path)
123
- Souls::Painter.update_file(file_path.to_s)
123
+ SOULs::Painter.update_file(file_path.to_s)
124
124
  end
125
125
  end
126
126
  end
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class Update < Thor
3
3
  desc "resolver [CLASS_NAME]", "Update GraphQL Type from schema.rb"
4
4
  def resolver(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
6
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
7
7
  dir_name = "./app/graphql/resolvers"
8
8
  new_file_path = "tmp/update_resolver.rb"
9
9
  file_path = "#{dir_name}/#{singularized_class_name}_search.rb"
@@ -17,7 +17,7 @@ module Souls
17
17
  new_line.write(line)
18
18
  if line.include?("argument") && !argument
19
19
  new_cols.each do |col|
20
- type = Souls.type_check(col[:type])
20
+ type = SOULs.type_check(col[:type])
21
21
  type = "[#{type}]" if col[:array]
22
22
  add_line = " argument :#{col[:column_name]}, #{type}, required: false\n"
23
23
  new_line.write(add_line) unless args.include?(col[:column_name])
@@ -25,7 +25,7 @@ module Souls
25
25
  argument = true
26
26
  elsif line.include?("scope = ::") && !scope
27
27
  new_cols.each do |col|
28
- type = Souls.type_check(col[:type])
28
+ type = SOULs.type_check(col[:type])
29
29
  type = "[#{type}]" if col[:array]
30
30
 
31
31
  add_line =
@@ -45,7 +45,7 @@ module Souls
45
45
  end
46
46
  FileUtils.rm(file_path)
47
47
  FileUtils.mv(new_file_path, file_path)
48
- Souls::Painter.update_file(file_path.to_s)
48
+ SOULs::Painter.update_file(file_path.to_s)
49
49
  end
50
50
 
51
51
  private
@@ -1,10 +1,10 @@
1
- module Souls
1
+ module SOULs
2
2
  class Update < Thor
3
3
  desc "rspec_factory [CLASS_NAME]", "Update GraphQL Type from schema.rb"
4
4
  def rspec_factory(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
6
  pluralized_class_name = class_name.pluralize.underscore
7
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
7
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
8
8
  dir_name = "./spec/factories"
9
9
  new_file_path = "tmp/create_factory.rb"
10
10
  file_path = "#{dir_name}/#{pluralized_class_name}.rb"
@@ -18,7 +18,7 @@ module Souls
18
18
  new_cols.each do |col|
19
19
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
20
20
 
21
- type = Souls.get_test_type(col[:type])
21
+ type = SOULs.get_test_type(col[:type])
22
22
  type = "[#{type}]" if col[:array]
23
23
  args = check_factory_argument(class_name: class_name)
24
24
 
@@ -30,7 +30,7 @@ module Souls
30
30
  end
31
31
  FileUtils.rm(file_path)
32
32
  FileUtils.mv(new_file_path, file_path)
33
- Souls::Painter.update_file(file_path.to_s)
33
+ SOULs::Painter.update_file(file_path.to_s)
34
34
  end
35
35
 
36
36
  private
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class Update < Thor
3
3
  desc "rspec_mutation [CLASS_NAME]", "Update GraphQL Type from schema.rb"
4
4
  def rspec_mutation(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
6
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
7
7
  dir_name = "./spec/mutations/base"
8
8
  new_file_path = "tmp/rspec_mutation.rb"
9
9
  file_path = "#{dir_name}/#{singularized_class_name}_spec.rb"
@@ -21,7 +21,7 @@ module Souls
21
21
 
22
22
  if line.include?('#{') && !argument
23
23
  new_cols.each do |col|
24
- type = Souls.type_check(col[:type])
24
+ type = SOULs.type_check(col[:type])
25
25
  next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
26
26
 
27
27
  type_line =
@@ -47,7 +47,7 @@ module Souls
47
47
  elsif test_res && line.include?("=> be_")
48
48
  test_args = check_rspec_mutation_argument(class_name: class_name, action: "test_args")
49
49
  new_cols.each do |col|
50
- type = Souls.type_check(col[:type])
50
+ type = SOULs.type_check(col[:type])
51
51
  text =
52
52
  case type
53
53
  when "Integer", "Float"
@@ -68,7 +68,7 @@ module Souls
68
68
  end
69
69
  FileUtils.rm(file_path)
70
70
  FileUtils.mv(new_file_path, file_path)
71
- Souls::Painter.update_file(file_path.to_s)
71
+ SOULs::Painter.update_file(file_path.to_s)
72
72
  end
73
73
 
74
74
  private
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class Update < Thor
3
3
  desc "rspec_resolver [CLASS_NAME]", "Update GraphQL Type from schema.rb"
4
4
  def rspec_resolver(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
6
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
7
7
  dir_name = "./spec/resolvers"
8
8
  new_file_path = "tmp/rspec_resolver.rb"
9
9
  file_path = "#{dir_name}/#{singularized_class_name}_search_spec.rb"
@@ -29,7 +29,7 @@ module Souls
29
29
  elsif test_res && line.include?("=> be_")
30
30
  test_args = check_rspec_resolver_argument(class_name: class_name, action: "test_args")
31
31
  new_cols.each do |col|
32
- type = Souls.type_check(col[:type])
32
+ type = SOULs.type_check(col[:type])
33
33
  text =
34
34
  case type
35
35
  when "Integer", "Float"
@@ -50,7 +50,7 @@ module Souls
50
50
  end
51
51
  FileUtils.rm(file_path)
52
52
  FileUtils.mv(new_file_path, file_path)
53
- Souls::Painter.update_file(file_path.to_s)
53
+ SOULs::Painter.update_file(file_path.to_s)
54
54
  end
55
55
 
56
56
  private
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class Update < Thor
3
3
  desc "type [CLASS_NAME]", "Update GraphQL Type from schema.rb"
4
4
  def type(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
6
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
7
7
  dir_name = "./app/graphql/types"
8
8
  new_file_path = "tmp/create_type.rb"
9
9
  file_path = "#{dir_name}/#{singularized_class_name}_type.rb"
@@ -15,7 +15,7 @@ module Souls
15
15
  next unless line.include?("field") && !argument
16
16
 
17
17
  new_cols.each do |col|
18
- type = Souls.get_type(col[:type])
18
+ type = SOULs.get_type(col[:type])
19
19
  type = "[#{type}]" if col[:array]
20
20
  args = check_type_argument(class_name: class_name)
21
21
  unless args.include?(col[:column_name])
@@ -28,7 +28,7 @@ module Souls
28
28
  end
29
29
  FileUtils.rm(file_path)
30
30
  FileUtils.mv(new_file_path, file_path)
31
- Souls::Painter.update_file(file_path.to_s)
31
+ SOULs::Painter.update_file(file_path.to_s)
32
32
  end
33
33
 
34
34
  private
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Update < Thor
3
3
  desc "type_rbs [CLASS_NAME]", "Update GraphQL Type from schema.rb"
4
4
  def type_rbs(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
6
  new_cols = ""
7
- Dir.chdir(Souls.get_api_path.to_s) do
8
- new_cols = Souls.get_columns_num(class_name: singularized_class_name)
7
+ Dir.chdir(SOULs.get_api_path.to_s) do
8
+ new_cols = SOULs.get_columns_num(class_name: singularized_class_name)
9
9
  end
10
10
  dir_name = "./sig/api/app/graphql/types"
11
11
  new_file_path = "config/create_type.rbs"
@@ -21,7 +21,7 @@ module Souls
21
21
  argument = false
22
22
  elsif line.include?("def self.field:") && !argument
23
23
  new_cols.each_with_index do |col, i|
24
- type = Souls.get_type(col[:type])
24
+ type = SOULs.get_type(col[:type])
25
25
  type = "[#{type}]" if col[:array]
26
26
  if i.zero?
27
27
  new_line.write(" def self.field: (:#{col[:column_name]}, #{type}, null: true) -> #{type}\n")
@@ -38,7 +38,7 @@ module Souls
38
38
  end
39
39
  FileUtils.rm(file_path)
40
40
  FileUtils.mv(new_file_path, file_path)
41
- Souls::Painter.update_file(file_path.to_s)
41
+ SOULs::Painter.update_file(file_path.to_s)
42
42
  end
43
43
  end
44
44
  end
@@ -1,8 +1,8 @@
1
- module Souls
1
+ module SOULs
2
2
  class Upgrade < Thor
3
3
  desc "config", "Update config/souls.rb"
4
4
  def config
5
- souls = Souls.configuration
5
+ souls = SOULs.configuration
6
6
  prompt = TTY::Prompt.new
7
7
  regions = `gcloud app regions list | awk '{print $1}'`.split("\n")
8
8
  regions.shift
@@ -10,7 +10,7 @@ module Souls
10
10
  region = prompt.select("Region:", regions, default: souls.region)
11
11
  endpoint = prompt.ask("Endpoint:", default: souls.endpoint)
12
12
 
13
- Dir.chdir(Souls.get_mother_path.to_s) do
13
+ Dir.chdir(SOULs.get_mother_path.to_s) do
14
14
  mother_conf_path = "config/souls.rb"
15
15
  api_conf_path = "apps/api/config/souls.rb"
16
16
  mother_conf = File.readlines(mother_conf_path)
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Upgrade < Thor
3
3
  desc "gemfile", "Update Gemfile/Gemfile.lock Version"
4
4
  def gemfile
@@ -18,7 +18,7 @@ module Souls
18
18
  new_gems = gemfile_latest_version
19
19
  logs = []
20
20
  message = "Already Up to date!"
21
- return "Already Up to date!" && Souls::Painter.warning(message) if new_gems[:gems].blank?
21
+ return "Already Up to date!" && SOULs::Painter.warning(message) if new_gems[:gems].blank?
22
22
 
23
23
  @i = 0
24
24
  File.open(file_path, "r") do |f|
@@ -72,7 +72,7 @@ module Souls
72
72
  FileUtils.rm("./Gemfile.lock")
73
73
  FileUtils.mv("./config/Gemfile", "./Gemfile")
74
74
  system("bundle update")
75
- Souls::Painter.success("\n\nSuccessfully Updated These Gems!\n")
75
+ SOULs::Painter.success("\n\nSuccessfully Updated These Gems!\n")
76
76
  logs.each do |line|
77
77
  puts(line)
78
78
  end
@@ -94,7 +94,7 @@ module Souls
94
94
  url = URI("https://rubygems.org/api/v1/versions/#{gem[0]}/latest.json")
95
95
  res = Net::HTTP.get_response(url)
96
96
  data = JSON.parse(res.body)
97
- next if Souls.configuration.fixed_gems.include?(gem[0].to_s)
97
+ next if SOULs.configuration.fixed_gems.include?(gem[0].to_s)
98
98
  next if data["version"].to_s == gem[1].to_s
99
99
 
100
100
  updated_lines << if from_dev
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Upgrade < Thor
3
3
  desc "submodule", "Run git submodule update --init RBS collection"
4
4
  def submodule
data/lib/souls/cli.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "souls"
2
- module Souls
2
+ module SOULs
3
3
  class CLI < Thor
4
4
  desc "generate [COMMAND]", "SOULs Generate Commands"
5
5
  subcommand "generate", Generate
@@ -46,17 +46,17 @@ module Souls
46
46
 
47
47
  desc "version", "SOULs Version"
48
48
  def version
49
- puts(Souls::VERSION)
49
+ puts(SOULs::VERSION)
50
50
  end
51
51
 
52
52
  desc "test", "Run Rspec & Rubocop"
53
53
  method_option :all, type: :boolean, aliases: "--all", default: false, desc: "Run (Rspec & steep check & Rubocop)"
54
54
  def test
55
55
  if options[:all]
56
- Dir.chdir(Souls.get_mother_path.to_s) do
56
+ Dir.chdir(SOULs.get_mother_path.to_s) do
57
57
  system("steep check")
58
58
  end
59
- Dir.chdir(Souls.get_api_path.to_s) do
59
+ Dir.chdir(SOULs.get_api_path.to_s) do
60
60
  system("rubocop -A")
61
61
  system("bundle exec rspec")
62
62
  end
@@ -68,7 +68,7 @@ module Souls
68
68
 
69
69
  desc "check", "Run steep check"
70
70
  def check
71
- Dir.chdir(Souls.get_mother_path.to_s) do
71
+ Dir.chdir(SOULs.get_mother_path.to_s) do
72
72
  system("steep check")
73
73
  end
74
74
  end
data/lib/souls/index.rb CHANGED
@@ -7,5 +7,5 @@ require_relative "./cli/index"
7
7
  require_relative "./utils/index"
8
8
  require_relative "./app/index"
9
9
 
10
- module Souls
10
+ module SOULs
11
11
  end
@@ -1,10 +1,10 @@
1
1
  require "fileutils"
2
- module Souls
2
+ module SOULs
3
3
  SOULS_PATH =
4
4
  if FileUtils.pwd.split("/").last == "souls"
5
5
  ".".freeze
6
6
  else
7
- "#{Gem.dir}/gems/souls-#{Souls::VERSION}".freeze
7
+ "#{Gem.dir}/gems/souls-#{SOULs::VERSION}".freeze
8
8
  end
9
9
  public_constant :SOULS_PATH
10
10
  end