souls 1.17.2 → 1.18.2

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 (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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed8954cfa416f493f139dcdc228d6987158d8ba8085a2fc5bfe2a1408c90d708
4
- data.tar.gz: 8e58f290f6a5487fc4b90a808793c2b09af384e40f859a8c6e785372daae1555
3
+ metadata.gz: 76cf8f87a732809e9d391db6d649b6f432811c43e27c8958e35588be10345d82
4
+ data.tar.gz: f5d261beee788956c05c8a1f18b92ba00e54e676ff8d80407e5b778f56808e81
5
5
  SHA512:
6
- metadata.gz: de8d45d0dd37bb9a58ffc1979dfe68e4bb5982ca6146e86745827ee277e5ce21d899a14a0c44b7b38e87608939efff93a73f65d306c79395e91e33b3448631bb
7
- data.tar.gz: 66b51c0972ecbd422ea3d2e5fab44577ecaddeb751b53282d32cf48d66f273099b0d0cdc2431ec591f5c66acb33407624e51d09add90542ab55077e2e2a35e59
6
+ metadata.gz: 680a29548c55d7862cd76b1bb68c47386e7416d71084f3559a7a6fbb2847d287e6df099d4612e4fb5c9bf15e2a0bc25335b16f852561ea051e7d79ff6ce84341
7
+ data.tar.gz: d2e6906c5eacb6745cedbdef3428f37d8f13eee75a21e199f2f5e7e7762e0ae233033bd7c2030783d4e18dc47fd68243901f8fe1f766ebcf2c9c038e6cfecedb
data/README.md CHANGED
@@ -145,4 +145,4 @@ The gem is available as open source under the terms of the [Apache-2.0 License](
145
145
 
146
146
  ## Code of Conduct
147
147
 
148
- Everyone interacting in the Souls project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elsoul/souls/blob/master/CODE_OF_CONDUCT.md).
148
+ Everyone interacting in the SOULs project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elsoul/souls/blob/master/CODE_OF_CONDUCT.md).
data/exe/souls CHANGED
@@ -3,7 +3,7 @@ require "souls"
3
3
  require "thor"
4
4
  begin
5
5
  souls_command = ARGV[0]
6
- require(Souls.get_mother_path.to_s + "/config/souls") unless [
6
+ require(SOULs.get_mother_path.to_s + "/config/souls") unless [
7
7
  "new",
8
8
  "docker",
9
9
  "-v",
@@ -15,4 +15,4 @@ rescue StandardError
15
15
  raise(StandardError, "No config! Please make `./config/souls.rb` File!")
16
16
  end
17
17
 
18
- Souls::CLI.start
18
+ SOULs::CLI.start
@@ -1,5 +1,5 @@
1
- module Souls
2
- class SoulsConnection < GraphQL::Types::Relay::BaseConnection
1
+ module SOULs
2
+ class SOULsConnection < GraphQL::Types::Relay::BaseConnection
3
3
  field :total_count, Integer, null: false do
4
4
  description "Total number of items"
5
5
  end
@@ -1,6 +1,15 @@
1
- module Souls
2
- class SoulsMutation < GraphQL::Schema::RelayClassicMutation
3
- def souls_fb_auth(token:)
1
+ module SOULs
2
+ class SOULsMutation < GraphQL::Schema::RelayClassicMutation
3
+ def self.souls_check_user_permissions(user, obj, method)
4
+ raise(StandardError, "Invalid or Missing Token") unless user
5
+
6
+ policy_class = obj.class.name + "Policy"
7
+ policy_clazz = policy_class.constantize.new(user, obj)
8
+ permission = policy_clazz.public_send(method)
9
+ raise(Pundit::NotAuthorizedError, "permission error!") unless permission
10
+ end
11
+
12
+ def self.souls_fb_auth(token:)
4
13
  FirebaseIdToken::Certificates.request!
5
14
  sleep(3) if ENV["RACK_ENV"] == "development"
6
15
  user = FirebaseIdToken::Signature.verify(token)
@@ -9,13 +18,13 @@ module Souls
9
18
  user
10
19
  end
11
20
 
12
- def publish_pubsub_queue(topic_name: "send-mail-job", message: "text!")
21
+ def self.souls_publish_pubsub_queue(topic_name: "send-mail-job", message: "text!")
13
22
  pubsub = Google::Cloud::Pubsub.new(project: ENV["SOULS_GCP_PROJECT_ID"])
14
23
  topic = pubsub.topic(topic_name)
15
24
  topic.publish(message)
16
25
  end
17
26
 
18
- def make_graphql_query(query: "newCommentMailer", args: {})
27
+ def self.souls_make_graphql_query(query: "newCommentMailer", args: {})
19
28
  if args.blank?
20
29
  query_string = %(query { #{query.to_s.underscore.camelize(:lower)} { response } })
21
30
  else
@@ -33,20 +42,20 @@ module Souls
33
42
  query_string
34
43
  end
35
44
 
36
- def post_to_dev(worker_name: "", query_string: "")
37
- app = Souls.configuration.app
38
- port = get_worker(worker_name: "souls-#{app}-#{worker_name}")[0][:port]
39
- endpoint = Souls.configuration.endpoint
45
+ def self.souls_post_to_dev(worker_name: "", query_string: "")
46
+ app = SOULs.configuration.app
47
+ port = souls_get_worker(worker_name: "souls-#{app}-#{worker_name}")[0][:port]
48
+ endpoint = SOULs.configuration.endpoint
40
49
  res = Net::HTTP.post_form(URI.parse("http://localhost:#{port}#{endpoint}"), { query: query_string })
41
50
  res.body
42
51
  end
43
52
 
44
- def get_worker(worker_name: "")
45
- workers = Souls.configuration.workers
53
+ def self.souls_get_worker(worker_name: "")
54
+ workers = SOULs.configuration.workers
46
55
  workers.filter { |n| n[:name] == worker_name }
47
56
  end
48
57
 
49
- def auth_check(context)
58
+ def self.souls_auth_check(context)
50
59
  raise(GraphQL::ExecutionError, "You need to sign in!!") if context[:user].nil?
51
60
  end
52
61
 
@@ -1,10 +1,19 @@
1
- module Souls
2
- class SoulsQuery < GraphQL::Schema::Resolver
1
+ module SOULs
2
+ class SOULsQuery < GraphQL::Schema::Resolver
3
3
  @schedule = nil
4
4
  class << self
5
5
  attr_accessor :schedule
6
6
  end
7
7
 
8
+ def self.check_user_permissions(user, obj, method)
9
+ raise(StandardError, "Invalid or Missing Token") unless user
10
+
11
+ policy_class = obj.class.name + "Policy"
12
+ policy_clazz = policy_class.constantize.new(user, obj)
13
+ permission = policy_clazz.public_send(method)
14
+ raise(Pundit::NotAuthorizedError, "permission error!") unless permission
15
+ end
16
+
8
17
  def self.cron(schedule)
9
18
  self.schedule = schedule
10
19
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  class BaseArgument < GraphQL::Schema::Argument
4
4
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  class BaseEnum < GraphQL::Schema::Enum
4
4
  end
@@ -1,7 +1,7 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  class BaseField < GraphQL::Schema::Field
4
- argument_class Souls::Types::BaseArgument
4
+ argument_class SOULs::Types::BaseArgument
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  class BaseInputObject < GraphQL::Schema::InputObject
4
- argument_class Souls::Types::BaseArgument
4
+ argument_class SOULs::Types::BaseArgument
5
5
  end
6
6
  end
7
7
  end
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  module BaseInterface
4
4
  include GraphQL::Schema::Interface
5
5
 
6
- field_class Souls::Types::BaseField
6
+ field_class SOULs::Types::BaseField
7
7
  end
8
8
  end
9
9
  end
@@ -1,8 +1,19 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  class BaseObject < GraphQL::Schema::Object
4
- field_class Souls::Types::BaseField
5
- connection_type_class Souls::SoulsConnection
4
+ field_class SOULs::Types::BaseField
5
+ connection_type_class SOULs::SOULsConnection
6
+
7
+ def self.get_tables
8
+ path = "./db/schema.rb"
9
+ tables = []
10
+ File.open(path, "r") do |f|
11
+ f.each_line.with_index do |line, _i|
12
+ tables << line.split("\"")[1] if line.include?("create_table")
13
+ end
14
+ end
15
+ tables
16
+ end
6
17
  end
7
18
  end
8
19
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  class BaseScalar < GraphQL::Schema::Scalar
4
4
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  module Types
3
3
  class BaseUnion < GraphQL::Schema::Union
4
4
  end
@@ -7,5 +7,5 @@ require_relative "base_object"
7
7
  require_relative "base_scalar"
8
8
  require_relative "base_union"
9
9
 
10
- module Souls
10
+ module SOULs
11
11
  end
@@ -0,0 +1,29 @@
1
+ module SOULs
2
+ module Types
3
+ class MutationObject < SOULs::Types::BaseObject
4
+ get_tables.each do |t|
5
+ %w[create update delete destroy_delete].each do |a|
6
+ field "#{a}_#{t.singularize.underscore}".to_sym,
7
+ mutation: Object.const_get(
8
+ "Mutations::Base::#{t.singularize.camelize}::#{a.camelize}#{t.singularize.camelize}"
9
+ )
10
+ end
11
+ end
12
+ managers =
13
+ Dir["./app/graphql/mutations/managers/*_manager/*.rb"].map do |file|
14
+ dir_name = file.scan(%r{managers/(.+?)_manager}).flatten[0]
15
+ file_name = file.scan(%r{/([^/]+)/?$}).flatten[0].gsub(".rb", "")
16
+ {
17
+ class: dir_name,
18
+ name: file_name
19
+ }
20
+ end
21
+ managers.each do |file|
22
+ field file[:name].underscore.to_s.to_sym,
23
+ mutation: Object.const_get(
24
+ "Mutations::Managers::#{file[:class].singularize.camelize}Manager::#{file[:name].singularize.camelize}"
25
+ )
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,16 @@
1
+ module SOULs
2
+ module Types
3
+ class QueryObject < SOULs::Types::BaseObject
4
+ add_field(GraphQL::Types::Relay::NodeField)
5
+ add_field(GraphQL::Types::Relay::NodesField)
6
+ get_tables.each do |t|
7
+ field t.singularize.underscore.to_s.to_sym, resolver: Object.const_get("Queries::#{t.singularize.camelize}")
8
+ field "#{t.singularize.underscore}_search".to_sym,
9
+ resolver: Object.const_get("Resolvers::#{t.singularize.camelize}Search")
10
+ field t.pluralize.underscore.to_s.to_sym,
11
+ Object.const_get("Types::#{t.singularize.camelize}Type").connection_type,
12
+ null: true
13
+ end
14
+ end
15
+ end
16
+ end
@@ -6,5 +6,5 @@ require_relative "utils/painter"
6
6
  require_relative "utils/firebase_id_token"
7
7
  require_relative "graphql/types/index"
8
8
 
9
- module Souls
9
+ module SOULs
10
10
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  module Painter
3
3
  class << self
4
4
  def create_file(text)
@@ -1,5 +1,5 @@
1
- module Souls
2
- module SoulsLogger
1
+ module SOULs
2
+ module SOULsLogger
3
3
  class Configuration
4
4
  attr_accessor :logger
5
5
 
@@ -47,7 +47,7 @@ module Souls
47
47
  entry.log_name = "error"
48
48
  entry.resource.type = "cloud_run_revision"
49
49
  entry.resource.labels[:service_name] = "souls"
50
- entry.resource.labels[:revision_name] = Souls::VERSION
50
+ entry.resource.labels[:revision_name] = SOULs::VERSION
51
51
 
52
52
  entry
53
53
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class CLIException < StandardError
3
3
  attr_reader :message
4
4
 
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class CLI < Thor
3
3
  desc "console", "Run IRB Console"
4
4
  method_option :env, aliases: "--e", default: "development", desc: "Difine APP Enviroment - development | production"
@@ -1,10 +1,10 @@
1
1
  require_relative "./templates/functions_env_yaml"
2
2
 
3
- Dir["#{Souls::SOULS_PATH}/lib/souls/cli/create/templates/*/*.rb"].map do |f|
3
+ Dir["#{SOULs::SOULS_PATH}/lib/souls/cli/create/templates/*/*.rb"].map do |f|
4
4
  require f
5
5
  end
6
6
 
7
- module Souls
7
+ module SOULs
8
8
  class Create < Thor
9
9
  desc "functions [name]", "Create SOULs functions"
10
10
  def functions(function_name)
@@ -44,7 +44,7 @@ module Souls
44
44
  end
45
45
  file_name = file_dir.gsub("./apps/", "")
46
46
  File.write(file_path, Object.const_get("Template::#{runtime}").__send__(method, file_name))
47
- Souls::Painter.create_file(file_path)
47
+ SOULs::Painter.create_file(file_path)
48
48
  end
49
49
  create_env_yaml(file_dir: file_dir)
50
50
  end
@@ -57,12 +57,12 @@ module Souls
57
57
  raise(StandardError, "Already Exist!") if File.exist?(file_path)
58
58
 
59
59
  File.write(file_path, Template.functions_env_yaml)
60
- Souls::Painter.create_file(file_path)
60
+ SOULs::Painter.create_file(file_path)
61
61
  file_path
62
62
  end
63
63
 
64
64
  def get_runtime_create_method(runtime:)
65
- Dir["#{Souls::SOULS_PATH}/lib/souls/cli/create/templates/#{runtime}/*"].map do |n|
65
+ Dir["#{SOULs::SOULS_PATH}/lib/souls/cli/create/templates/#{runtime}/*"].map do |n|
66
66
  n.split("/").last.gsub(".rb", "")
67
67
  end
68
68
  end
@@ -1,16 +1,16 @@
1
1
  require_relative "./functions"
2
- module Souls
2
+ module SOULs
3
3
  class Create < Thor
4
4
  desc "worker [name]", "Create SOULs Worker"
5
5
  def worker(name)
6
- require("#{Souls.get_mother_path}/config/souls")
7
- Dir.chdir(Souls.get_mother_path.to_s) do
6
+ require("#{SOULs.get_mother_path}/config/souls")
7
+ Dir.chdir(SOULs.get_mother_path.to_s) do
8
8
  worker_name = "worker-#{name}"
9
9
  file_dir = "apps/worker-#{name}"
10
10
  raise(StandardError, "Same Worker Already Exist!") if Dir.exist?(file_dir)
11
11
 
12
- workers = Souls.configuration.workers
13
- app = Souls.configuration.app
12
+ workers = SOULs.configuration.workers
13
+ app = SOULs.configuration.app
14
14
  port = 3000 + workers.size
15
15
  souls_worker_name = "souls-#{app}-#{worker_name}"
16
16
  download_worker(worker_name: worker_name)
@@ -64,7 +64,7 @@ module Souls
64
64
  end
65
65
 
66
66
  def souls_conf_update(worker_name: "worker-mailer", strain: "mother")
67
- workers = Souls.configuration.workers
67
+ workers = SOULs.configuration.workers
68
68
  port = 3000 + workers.size
69
69
  file_path = strain == "mother" ? "config/souls.rb" : "apps/api/config/souls.rb"
70
70
 
@@ -206,20 +206,20 @@ end
206
206
  --set-env-vars="SOULS_PROJECT_ID=${{ secrets.SOULS_GCP_PROJECT_ID }}"
207
207
  TEXT
208
208
  end
209
- Souls::Painter.create_file(file_path.to_s)
209
+ SOULs::Painter.create_file(file_path.to_s)
210
210
  file_path
211
211
  end
212
212
 
213
213
  def souls_config_init(worker_name: "worker-mailer")
214
- app_name = Souls.configuration.app
215
- project_id = Souls.configuration.project_id
214
+ app_name = SOULs.configuration.app
215
+ project_id = SOULs.configuration.project_id
216
216
  config_dir = "apps/#{worker_name}/config"
217
217
  FileUtils.mkdir_p(config_dir) unless Dir.exist?(config_dir)
218
218
  FileUtils.touch("#{config_dir}/souls.rb")
219
219
  file_path = "#{config_dir}/souls.rb"
220
220
  File.open(file_path, "w") do |f|
221
221
  f.write(<<~TEXT)
222
- Souls.configure do |config|
222
+ SOULs.configure do |config|
223
223
  config.app = "#{app_name}"
224
224
  config.project_id = "#{project_id}"
225
225
  config.region = "asia-northeast1"
@@ -238,7 +238,7 @@ end
238
238
  file_path = "#{file_dir}/souls_helper.rbs"
239
239
  File.open(file_path, "w") do |f|
240
240
  f.write(<<~TEXT)
241
- module SoulsHelper
241
+ module SOULsHelper
242
242
  def self.export_csv: (untyped model_name) -> (String? | StandardError )
243
243
  def self.export_model_to_csv: (untyped model_name) -> (untyped | StandardError )
244
244
  def self.upload_to_gcs: (String file_path, String upload_path) -> untyped
@@ -274,7 +274,7 @@ end
274
274
  end
275
275
 
276
276
  def download_worker(worker_name: "worker-mailer")
277
- version = Souls.get_latest_version_txt(service_name: "worker").join(".")
277
+ version = SOULs.get_latest_version_txt(service_name: "worker").join(".")
278
278
  file_name = "worker-v#{version}.tgz"
279
279
  url = "https://storage.googleapis.com/souls-bucket/boilerplates/workers/#{file_name}"
280
280
  puts(url)
@@ -305,7 +305,7 @@ end
305
305
  puts(line)
306
306
  welcome = Paint["SOULs Worker is Ready!", :white]
307
307
  puts(welcome)
308
- souls_ver = Paint["SOULs Version: #{Souls::VERSION}", :white]
308
+ souls_ver = Paint["SOULs Version: #{SOULs::VERSION}", :white]
309
309
  puts(souls_ver)
310
310
  puts(line)
311
311
  endroll = <<~TEXT
@@ -1,13 +1,13 @@
1
- module Souls
1
+ module SOULs
2
2
  class DB < Thor
3
3
  desc "create_migration [CLASS_NAME]", "Create ActiveRecord Migration File"
4
4
  def create_migration(class_name)
5
5
  pluralized_class_name = class_name.underscore.pluralize
6
6
  singularized_class_name = class_name.underscore.singularize
7
- Souls::DB.new.invoke(:model, [singularized_class_name], {})
8
- Souls::DB.new.invoke(:rspec_model, [singularized_class_name], {})
9
- Souls::DB.new.invoke(:model_rbs, [singularized_class_name], {})
10
- Souls::Painter.create_file("")
7
+ SOULs::DB.new.invoke(:model, [singularized_class_name], {})
8
+ SOULs::DB.new.invoke(:rspec_model, [singularized_class_name], {})
9
+ SOULs::DB.new.invoke(:model_rbs, [singularized_class_name], {})
10
+ SOULs::Painter.create_file("")
11
11
  system("rake db:create_migration NAME=create_#{pluralized_class_name}")
12
12
  file_path = Dir["db/migrate/*create_#{pluralized_class_name}.rb"].first
13
13
  File.open(file_path, "w") do |f|
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class DB < Thor
3
3
  desc "create_migration_rbs [CLASS_NAME]", "Generate ActiveRecord Migration's RBS Template"
4
4
  def create_migration_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/db/migrate"
8
8
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
9
  pluralized_class_name = class_name.underscore.pluralize
@@ -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
@@ -5,7 +5,7 @@ require_relative "./rspec_model"
5
5
  require_relative "./model_rbs"
6
6
  require_relative "../cli_exception"
7
7
 
8
- module Souls
8
+ module SOULs
9
9
  class DB < Thor
10
10
  desc "migrate", "Migrate Database"
11
11
  method_option :env, aliases: "--e", default: "development", desc: "Difine APP Enviroment - development | production"
@@ -102,7 +102,7 @@ module Souls
102
102
  private
103
103
 
104
104
  def db_system(cmd)
105
- system(cmd) or Souls::Painter.error("DB is not running. Please run `souls docker psql`")
105
+ system(cmd) or SOULs::Painter.error("DB is not running. Please run `souls docker psql`")
106
106
  end
107
107
  end
108
108
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class DB < Thor
3
3
  desc "model [CLASS_NAME]", "Generate Model Template"
4
4
  def model(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 DB < Thor
3
3
  desc "model_rbs [CLASS_NAME]", "Generate GraphQL Model RBS from schema.rb"
4
4
  def model_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/models/"
8
8
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
9
9
  singularized_class_name = class_name.underscore.singularize
@@ -14,7 +14,7 @@ module Souls
14
14
  end
15
15
  TEXT
16
16
  end
17
- Souls::Painter.create_file(file_path.to_s)
17
+ SOULs::Painter.create_file(file_path.to_s)
18
18
  end
19
19
  file_path
20
20
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class DB < Thor
3
3
  desc "rspec_model [CLASS_NAME]", "Generate Rspec Model Test from schema.rb"
4
4
  def rspec_model(class_name)
@@ -18,7 +18,7 @@ module Souls
18
18
  end
19
19
  TEXT
20
20
  end
21
- Souls::Painter.create_file(file_path.to_s)
21
+ SOULs::Painter.create_file(file_path.to_s)
22
22
  file_path
23
23
  end
24
24
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "scaffold [CLASS_NAME]", "Delete Scaffold"
4
4
  method_option :rbs, type: :boolean, aliases: "--rbs", default: false, desc: "Deletes Only RBS Files"
@@ -16,8 +16,8 @@ module Souls
16
16
  method_option :rbs, type: :boolean, aliases: "--rbs", default: false, desc: "Deletes Only RBS Files"
17
17
  def scaffold_all
18
18
  puts(Paint["Delete All Scaffold Files!\n", :cyan])
19
- Souls.get_tables.each do |table|
20
- Souls::Delete.new.invoke(:scaffold, [table.singularize], { rbs: options[:rbs] })
19
+ SOULs.get_tables.each do |table|
20
+ SOULs::Delete.new.invoke(:scaffold, [table.singularize], { rbs: options[:rbs] })
21
21
  end
22
22
  true
23
23
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "connection [CLASS_NAME]", "Delete GraphQL Connection"
4
4
  def connection(class_name)
@@ -6,7 +6,7 @@ module Souls
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_path = "#{file_dir}#{singularized_class_name}_connection.rb"
8
8
  FileUtils.rm_f(file_path)
9
- Souls::Painter.delete_file(file_path)
9
+ SOULs::Painter.delete_file(file_path)
10
10
  file_path
11
11
  end
12
12
  end
@@ -1,14 +1,14 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "connection_rbs [CLASS_NAME]", "Delete GraphQL Connection RBS"
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
  singularized_class_name = class_name.underscore.singularize
8
8
  file_dir = "./sig/api/app/graphql/types/connections/"
9
9
  file_path = "#{file_dir}#{singularized_class_name}_connection.rbs"
10
10
  FileUtils.rm_f(file_path)
11
- Souls::Painter.delete_file(file_path.to_s)
11
+ SOULs::Painter.delete_file(file_path.to_s)
12
12
  end
13
13
  file_path
14
14
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "edge [CLASS_NAME]", "Delete GraphQL Edge"
4
4
  def edge(class_name)
@@ -6,7 +6,7 @@ module Souls
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_path = "#{file_dir}#{singularized_class_name}_edge.rb"
8
8
  FileUtils.rm_f(file_path)
9
- Souls::Painter.delete_file(file_path.to_s)
9
+ SOULs::Painter.delete_file(file_path.to_s)
10
10
  file_path
11
11
  end
12
12
  end
@@ -1,13 +1,13 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "edge_rbs [CLASS_NAME]", "Delete GraphQL Edge RBS"
4
4
  def edge_rbs(class_name)
5
- Dir.chdir(Souls.get_mother_path.to_s) do
5
+ Dir.chdir(SOULs.get_mother_path.to_s) do
6
6
  file_dir = "./sig/api/app/graphql/types/edges/"
7
7
  singularized_class_name = class_name.underscore.singularize
8
8
  file_path = "#{file_dir}#{singularized_class_name}_edge.rbs"
9
9
  FileUtils.rm_f(file_path)
10
- Souls::Painter.delete_file(file_path)
10
+ SOULs::Painter.delete_file(file_path)
11
11
  file_path
12
12
  end
13
13
  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 Delete < Thor
17
17
  end
18
18
  end