souls 1.17.3 → 1.18.0

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 -13
  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,10 +1,10 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "migration [migration_NAME]", "Delete Migration files Template"
4
4
  def migration(class_name)
5
5
  singularized_class_name = class_name.underscore.singularize
6
6
  pluralized_class_name = class_name.underscore.pluralize
7
- Dir.chdir(Souls.get_mother_path.to_s) do
7
+ Dir.chdir(SOULs.get_mother_path.to_s) do
8
8
  file_paths = {
9
9
  model_file_path: "./apps/api/app/models/#{singularized_class_name}.rb",
10
10
  rspec_file_path: "./apps/api/spec/models/#{singularized_class_name}_spec.rb",
@@ -13,7 +13,7 @@ module Souls
13
13
  }
14
14
  file_paths.each do |_k, v|
15
15
  FileUtils.rm_f(v)
16
- Souls::Painter.delete_file(v)
16
+ SOULs::Painter.delete_file(v)
17
17
  rescue StandardError => e
18
18
  puts(e)
19
19
  end
@@ -1,14 +1,14 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "mutation [CLASS_NAME]", "Delete GraphQL Mutation"
4
4
  def mutation(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = ""
7
- Dir.chdir(Souls.get_api_path.to_s) do
7
+ Dir.chdir(SOULs.get_api_path.to_s) do
8
8
  file_path = "./app/graphql/mutations/base/#{singularized_class_name}/"
9
9
  FileUtils.rm_rf(file_path)
10
10
  end
11
- Souls::Painter.delete_file(file_path.to_s)
11
+ SOULs::Painter.delete_file(file_path.to_s)
12
12
  file_path
13
13
  end
14
14
  end
@@ -1,14 +1,14 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "mutation_rbs [CLASS_NAME]", "Delete GraphQL Mutation RBS"
4
4
  def mutation_rbs(class_name)
5
5
  singularized_class_name = class_name.underscore.singularize
6
6
  file_path = ""
7
- Dir.chdir(Souls.get_mother_path.to_s) do
7
+ Dir.chdir(SOULs.get_mother_path.to_s) do
8
8
  file_dir = "./sig/api/app/graphql/mutations/base/#{singularized_class_name}"
9
9
  FileUtils.rm_rf(file_dir)
10
10
  end
11
- Souls::Painter.delete_file(file_path.to_s)
11
+ SOULs::Painter.delete_file(file_path.to_s)
12
12
  file_path
13
13
  end
14
14
  end
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "query [CLASS_NAME]", "Delete GraphQL Query"
4
4
  def query(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./app/graphql/queries/#{singularized_class_name}*.rb"
7
7
  FileUtils.rm_f(file_path)
8
- Souls::Painter.delete_file(file_path.to_s)
8
+ SOULs::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -1,14 +1,14 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "query_rbs [CLASS_NAME]", "Delete GraphQL Query RBS"
4
4
  def query_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/queries/"
8
8
  singularized_class_name = class_name.underscore.singularize
9
9
  file_path = "#{file_dir}#{singularized_class_name}*.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
  file_path
13
13
  end
14
14
  end
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "resolver [CLASS_NAME]", "Delete GraphQL Resolver"
4
4
  def resolver(class_name)
5
5
  singularized_class_name = class_name.singularize.underscore
6
6
  file_path = "./app/graphql/resolvers/#{singularized_class_name}_search.rb"
7
7
  FileUtils.rm_f(file_path)
8
- Souls::Painter.delete_file(file_path.to_s)
8
+ SOULs::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -1,15 +1,15 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "resolver_rbs [CLASS_NAME]", "Delete GraphQL Resolver RBS"
4
4
  def resolver_rbs(class_name)
5
5
  singularized_class_name = class_name.underscore.singularize
6
6
  file_path = ""
7
- Dir.chdir(Souls.get_mother_path.to_s) do
7
+ Dir.chdir(SOULs.get_mother_path.to_s) do
8
8
  file_dir = "./sig/api/app/graphql/resolvers"
9
9
  file_path = "#{file_dir}/#{singularized_class_name}_search.rbs"
10
10
  FileUtils.rm_f(file_path)
11
11
  end
12
- Souls::Painter.delete_file(file_path.to_s)
12
+ SOULs::Painter.delete_file(file_path.to_s)
13
13
  file_path
14
14
  end
15
15
  end
@@ -1,10 +1,10 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "rspec_factory [CLASS_NAME]", "Delete Rspec Factory Test from schema.rb"
4
4
  def rspec_factory(class_name)
5
5
  file_path = "./spec/factories/#{class_name.pluralize}.rb"
6
6
  FileUtils.rm_f(file_path)
7
- Souls::Painter.delete_file(file_path.to_s)
7
+ SOULs::Painter.delete_file(file_path.to_s)
8
8
  file_path
9
9
  end
10
10
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "rspec_job [CLASS_NAME]", "Delete Rspec Job Test Template"
4
4
  def rspec_job(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}_spec.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,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "rspec_manager [CLASS_NAME]", "Delete Rspec Manager Test Template"
4
4
  method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
@@ -6,7 +6,7 @@ module Souls
6
6
  singularized_class_name = class_name.underscore.singularize
7
7
  file_path = "./spec/mutations/managers/#{singularized_class_name}/#{options[:mutation]}_spec.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,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "rspec_mutation [CLASS_NAME]", "Delete Rspec Mutation Test from schema.rb"
4
4
  def rspec_mutation(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/mutations/base/#{singularized_class_name}_spec.rb"
7
7
  FileUtils.rm_f(file_path)
8
- Souls::Painter.delete_file(file_path.to_s)
8
+ SOULs::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "rspec_query [CLASS_NAME]", "Delete Rspec Query Test"
4
4
  def rspec_query(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/queries/#{singularized_class_name}_spec.rb"
7
7
  FileUtils.rm_f(file_path)
8
- Souls::Painter.delete_file(file_path.to_s)
8
+ SOULs::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "rspec_resolver [CLASS_NAME]", "Delete Rspec Resolver Test"
4
4
  def rspec_resolver(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./spec/resolvers/#{singularized_class_name}_search_spec.rb"
7
7
  FileUtils.rm_f(file_path)
8
- Souls::Painter.delete_file(file_path.to_s)
8
+ SOULs::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -1,11 +1,11 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "type [CLASS_NAME]", "Delete GraphQL Type"
4
4
  def type(class_name)
5
5
  singularized_class_name = class_name.singularize
6
6
  file_path = "./app/graphql/types/#{singularized_class_name}_type.rb"
7
7
  FileUtils.rm_f(file_path)
8
- Souls::Painter.delete_file(file_path.to_s)
8
+ SOULs::Painter.delete_file(file_path.to_s)
9
9
  file_path
10
10
  end
11
11
  end
@@ -1,15 +1,15 @@
1
- module Souls
1
+ module SOULs
2
2
  class Delete < Thor
3
3
  desc "type_rbs [CLASS_NAME]", "Delete GraphQL Type RBS"
4
4
  def type_rbs(class_name)
5
5
  singularized_class_name = class_name.underscore.singularize
6
6
  file_path = ""
7
- Dir.chdir(Souls.get_mother_path.to_s) do
7
+ Dir.chdir(SOULs.get_mother_path.to_s) do
8
8
  file_dir = "./sig/api/app/graphql/types"
9
9
  file_path = "#{file_dir}/#{singularized_class_name}_type.rbs"
10
10
  FileUtils.rm_f(file_path)
11
11
  end
12
- Souls::Painter.delete_file(file_path.to_s)
12
+ SOULs::Painter.delete_file(file_path.to_s)
13
13
  file_path
14
14
  end
15
15
  end
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Docker < Thor
3
3
  desc "psql", "Run PostgreSQL13 Docker Container"
4
4
  def psql
@@ -1,10 +1,10 @@
1
- module Souls
1
+ module SOULs
2
2
  class Compute < Thor
3
3
  desc "setup_vpc_nat", "Set Up VPC Cloud Nat"
4
4
  method_option :range, default: "10.124.0.0/28", aliases: "--range", desc: "GCP VPC Network IP Range"
5
5
  def setup_vpc_nat
6
6
  puts(Paint["Initializing NAT Setup This process might take about 10 min...", :yellow])
7
- Souls::Gcloud.new.config_set
7
+ SOULs::Gcloud.new.config_set
8
8
  create_network
9
9
  create_firewall_tcp(range: options[:range])
10
10
  create_firewall_ssh
@@ -13,10 +13,10 @@ module Souls
13
13
  create_router
14
14
  create_external_ip
15
15
  create_nat
16
- Souls::Sql.new.invoke(:setup_private_ip)
16
+ SOULs::Sql.new.invoke(:setup_private_ip)
17
17
  update_workflows
18
18
  update_env
19
- Souls::Painter.success("Cloud NAT is All Set!")
19
+ SOULs::Painter.success("Cloud NAT is All Set!")
20
20
  puts(
21
21
  Paint % [
22
22
  "Your Worker's External IP: %{white_text}",
@@ -32,9 +32,9 @@ module Souls
32
32
  private
33
33
 
34
34
  def update_env
35
- instance_name = Souls.configuration.instance_name
35
+ instance_name = SOULs.configuration.instance_name
36
36
  private_instance_ip = `gcloud sql instances list | grep #{instance_name} | awk '{print $6}'`.strip
37
- Dir.chdir(Souls.get_mother_path.to_s) do
37
+ Dir.chdir(SOULs.get_mother_path.to_s) do
38
38
  file_path = ".env.production"
39
39
  env_production = File.readlines(file_path)
40
40
  env_production[0] = "SOULS_DB_HOST=#{private_instance_ip}\n"
@@ -44,17 +44,17 @@ module Souls
44
44
  end
45
45
 
46
46
  def get_external_ip
47
- app_name = Souls.configuration.app
47
+ app_name = SOULs.configuration.app
48
48
  `gcloud compute addresses list | grep #{app_name}-worker-ip | awk '{print $2}'`.strip
49
49
  end
50
50
 
51
51
  def create_network
52
- app_name = Souls.configuration.app
52
+ app_name = SOULs.configuration.app
53
53
  system("gcloud compute networks create #{app_name}")
54
54
  end
55
55
 
56
56
  def create_firewall_tcp(range: "10.124.0.0/28")
57
- app_name = Souls.configuration.app
57
+ app_name = SOULs.configuration.app
58
58
  system(
59
59
  "gcloud compute firewall-rules create #{app_name} \
60
60
  --network #{app_name} --allow tcp,udp,icmp --source-ranges #{range}"
@@ -62,7 +62,7 @@ module Souls
62
62
  end
63
63
 
64
64
  def create_firewall_ssh
65
- app_name = Souls.configuration.app
65
+ app_name = SOULs.configuration.app
66
66
  system(
67
67
  "gcloud compute firewall-rules create #{app_name}-ssh --network #{app_name} \
68
68
  --allow tcp:22,tcp:3389,icmp"
@@ -70,8 +70,8 @@ module Souls
70
70
  end
71
71
 
72
72
  def create_subnet(range: "10.124.0.0/28")
73
- app_name = Souls.configuration.app
74
- region = Souls.configuration.region
73
+ app_name = SOULs.configuration.app
74
+ region = SOULs.configuration.region
75
75
  system(
76
76
  "gcloud compute networks subnets create #{app_name}-subnet \
77
77
  --range=#{range} --network=#{app_name} --region=#{region}"
@@ -79,9 +79,9 @@ module Souls
79
79
  end
80
80
 
81
81
  def create_connector
82
- app_name = Souls.configuration.app
83
- project_id = Souls.configuration.project_id
84
- region = Souls.configuration.region
82
+ app_name = SOULs.configuration.app
83
+ project_id = SOULs.configuration.project_id
84
+ region = SOULs.configuration.region
85
85
  system(
86
86
  "gcloud compute networks vpc-access connectors create #{app_name}-connector \
87
87
  --region=#{region} \
@@ -91,20 +91,20 @@ module Souls
91
91
  end
92
92
 
93
93
  def create_router
94
- app_name = Souls.configuration.app
95
- region = Souls.configuration.region
94
+ app_name = SOULs.configuration.app
95
+ region = SOULs.configuration.region
96
96
  system("gcloud compute routers create #{app_name}-router --network=#{app_name} --region=#{region}")
97
97
  end
98
98
 
99
99
  def create_external_ip
100
- app_name = Souls.configuration.app
101
- region = Souls.configuration.region
100
+ app_name = SOULs.configuration.app
101
+ region = SOULs.configuration.region
102
102
  system("gcloud compute addresses create #{app_name}-worker-ip --region=#{region}")
103
103
  end
104
104
 
105
105
  def create_nat
106
- app_name = Souls.configuration.app
107
- region = Souls.configuration.region
106
+ app_name = SOULs.configuration.app
107
+ region = SOULs.configuration.region
108
108
  system(
109
109
  "gcloud compute routers nats create #{app_name}-worker-nat \
110
110
  --router=#{app_name}-router \
@@ -119,8 +119,8 @@ module Souls
119
119
  end
120
120
 
121
121
  def update_workflows
122
- app_name = Souls.configuration.app
123
- Dir.chdir(Souls.get_mother_path.to_s) do
122
+ app_name = SOULs.configuration.app
123
+ Dir.chdir(SOULs.get_mother_path.to_s) do
124
124
  workflow_paths = Dir[".github/workflows/*.yml"]
125
125
  workflow_paths.each do |file_path|
126
126
  workflow = File.readlines(file_path)
@@ -133,7 +133,7 @@ module Souls
133
133
  end
134
134
  workflow.insert(index, " --vpc-connector=#{app_name}-connector \\\n") if connector_index.nil?
135
135
  File.open(file_path, "w") { |f| f.write(workflow.join) }
136
- Souls::Painter.update_file(file_path.to_s)
136
+ SOULs::Painter.update_file(file_path.to_s)
137
137
  end
138
138
  end
139
139
  end
@@ -1,12 +1,12 @@
1
- module Souls
1
+ module SOULs
2
2
  class Functions < Thor
3
3
  desc "deploy", "Deploy Cloud Functions"
4
4
  def deploy
5
- require(Souls.get_mother_path.to_s + "/config/souls")
6
- project_id = Souls.configuration.project_id
5
+ require(SOULs.get_mother_path.to_s + "/config/souls")
6
+ project_id = SOULs.configuration.project_id
7
7
  current_dir = FileUtils.pwd.split("/").last
8
8
  unless current_dir.match?(/^cf_/)
9
- Souls::Painter.error("You are at wrong dir!\nPlease go to `apps/functions` dir!")
9
+ SOULs::Painter.error("You are at wrong dir!\nPlease go to `apps/functions` dir!")
10
10
  return false
11
11
  end
12
12
 
@@ -21,46 +21,46 @@ module Souls
21
21
 
22
22
  desc "describe", "Describe SOULs Functions"
23
23
  def describe
24
- require(Souls.get_mother_path.to_s + "/config/souls")
25
- project_id = Souls.configuration.project_id
24
+ require(SOULs.get_mother_path.to_s + "/config/souls")
25
+ project_id = SOULs.configuration.project_id
26
26
  system("gcloud functions describe souls_functions --project=#{project_id}")
27
27
  end
28
28
 
29
29
  desc "delete", "Delete SOULs Functions"
30
30
  def delete(name)
31
- require(Souls.get_mother_path.to_s + "/config/souls")
32
- project_id = Souls.configuration.project_id
31
+ require(SOULs.get_mother_path.to_s + "/config/souls")
32
+ project_id = SOULs.configuration.project_id
33
33
  system("gcloud functions delete #{name} --project=#{project_id}")
34
- Dir.chdir(Souls.get_mother_path.to_s) do
34
+ Dir.chdir(SOULs.get_mother_path.to_s) do
35
35
  FileUtils.rm_rf("apps/#{name}")
36
36
  end
37
- Souls::Painter.success("Deleted #{name} functions!")
37
+ SOULs::Painter.success("Deleted #{name} functions!")
38
38
  end
39
39
 
40
40
  desc "url", "Get SOULs Functions URL"
41
41
  def url
42
- require(Souls.get_mother_path.to_s + "/config/souls")
43
- project_id = Souls.configuration.project_id
42
+ require(SOULs.get_mother_path.to_s + "/config/souls")
43
+ project_id = SOULs.configuration.project_id
44
44
  current_dir = FileUtils.pwd.split("/").last
45
- Souls::Painter.success(`gcloud functions describe #{current_dir} --project=#{project_id}| grep url`)
45
+ SOULs::Painter.success(`gcloud functions describe #{current_dir} --project=#{project_id}| grep url`)
46
46
  end
47
47
 
48
48
  desc "all_url", "Get SOULs Functions All URL"
49
49
  def all_url
50
- require(Souls.get_mother_path.to_s + "/config/souls")
51
- project_id = Souls.configuration.project_id
52
- Dir.chdir(Souls.get_mother_path.to_s) do
50
+ require(SOULs.get_mother_path.to_s + "/config/souls")
51
+ project_id = SOULs.configuration.project_id
52
+ Dir.chdir(SOULs.get_mother_path.to_s) do
53
53
  souls_functions = Dir["apps/cf_*"]
54
54
  cf_dir = souls_functions.map { |n| n.split("/").last }
55
55
  cf_dir.each do |dir|
56
- Souls::Painter.success(`gcloud functions describe #{dir} --project=#{project_id}| grep url`)
56
+ SOULs::Painter.success(`gcloud functions describe #{dir} --project=#{project_id}| grep url`)
57
57
  end
58
58
  end
59
59
  end
60
60
 
61
61
  desc "dev", "Check SOULs Functions dev"
62
62
  def dev
63
- Dir.chdir(Souls.get_functions_path.to_s) do
63
+ Dir.chdir(SOULs.get_functions_path.to_s) do
64
64
  current_dir = FileUtils.pwd.split("/").last
65
65
  system("bundle exec functions-framework-ruby --target #{current_dir}")
66
66
  end
@@ -1,18 +1,18 @@
1
- module Souls
1
+ module SOULs
2
2
  class Iam < Thor
3
3
  desc "setup_key", "Create Google Cloud IAM Service Account Key And Set All Permissions"
4
4
  def setup_key
5
- region = Souls.configuration.region
6
- Souls::Gcloud.new.auth_login
7
- Souls::Upgrade.new.config
5
+ region = SOULs.configuration.region
6
+ SOULs::Gcloud.new.auth_login
7
+ SOULs::Upgrade.new.config
8
8
  create_service_account
9
9
  create_service_account_key
10
- Souls::Gcloud.new.enable_permissions
10
+ SOULs::Gcloud.new.enable_permissions
11
11
  add_permissions
12
12
  begin
13
13
  system("gcloud app create --region=#{region} --quiet")
14
14
  rescue StandardError, error
15
- puts("gcloud app region is Already exist! - Souls::Gcloud::Iam.setup_key")
15
+ puts("gcloud app region is Already exist! - SOULs::Gcloud::Iam.setup_key")
16
16
  end
17
17
  begin
18
18
  set_gh_secret_json
@@ -25,18 +25,18 @@ module Souls
25
25
 
26
26
  desc "create_service_account", "Create Google Cloud IAM Service Account"
27
27
  def create_service_account
28
- app_name = Souls.configuration.app
28
+ app_name = SOULs.configuration.app
29
29
  system(
30
30
  "gcloud iam service-accounts create #{app_name} \
31
- --description='Souls Service Account' \
31
+ --description='SOULs Service Account' \
32
32
  --display-name=#{app_name}"
33
33
  )
34
34
  end
35
35
 
36
36
  desc "create_service_account_key", "Create Google Cloud Service Account Key"
37
37
  def create_service_account_key
38
- app_name = Souls.configuration.app
39
- project_id = Souls.configuration.project_id
38
+ app_name = SOULs.configuration.app
39
+ project_id = SOULs.configuration.project_id
40
40
  system(
41
41
  "gcloud iam service-accounts keys create ./config/keyfile.json \
42
42
  --iam-account #{app_name}@#{project_id}.iam.gserviceaccount.com"
@@ -80,8 +80,8 @@ module Souls
80
80
  end
81
81
 
82
82
  def add_service_account_role(role: "roles/firebase.admin")
83
- app_name = Souls.configuration.app
84
- project_id = Souls.configuration.project_id
83
+ app_name = SOULs.configuration.app
84
+ project_id = SOULs.configuration.project_id
85
85
  system(
86
86
  "gcloud projects add-iam-policy-binding #{project_id} \
87
87
  --member='serviceAccount:#{app_name}@#{project_id}.iam.gserviceaccount.com' \
@@ -7,7 +7,7 @@ require_relative "./scheduler/index"
7
7
  require_relative "./functions/index"
8
8
  require_relative "../cli_exception"
9
9
 
10
- module Souls
10
+ module SOULs
11
11
  class Gcloud < Thor
12
12
  desc "iam [COMMAND]", "souls gcloud iam Commands"
13
13
  subcommand "iam", Iam
@@ -34,16 +34,16 @@ module Souls
34
34
 
35
35
  desc "auth_login", "gcloud config set and gcloud auth login"
36
36
  def auth_login
37
- project_id = Souls.configuration.project_id
38
- system("gcloud projects describe #{project_id}", out: File::NULL) or raise(Souls::GcloudException)
37
+ project_id = SOULs.configuration.project_id
38
+ system("gcloud projects describe #{project_id}", out: File::NULL) or raise(SOULs::GcloudException)
39
39
  system("gcloud config set project #{project_id} >/dev/null 2>&1")
40
40
  system("gcloud auth login")
41
41
  end
42
42
 
43
43
  desc "config_set", "gcloud config set"
44
44
  def config_set
45
- project_id = Souls.configuration.project_id
46
- system("gcloud projects describe #{project_id}", out: File::NULL) or raise(Souls::GcloudException)
45
+ project_id = SOULs.configuration.project_id
46
+ system("gcloud projects describe #{project_id}", out: File::NULL) or raise(SOULs::GcloudException)
47
47
  system("gcloud config set project #{project_id} >/dev/null 2>&1")
48
48
  end
49
49
 
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Pubsub < Thor
3
3
  desc "create_subscription", "Create Google Cloud PubSub Subscription"
4
4
  method_option :topic_name,
@@ -10,8 +10,8 @@ module Souls
10
10
  aliases: "--endpoint",
11
11
  desc: "Google Cloud Pubsub Push Subscription Endpoint"
12
12
  def create_subscription
13
- project_id = Souls.configuration.project_id
14
- service_account = "#{Souls.configuration.app}@#{project_id}.iam.gserviceaccount.com"
13
+ project_id = SOULs.configuration.project_id
14
+ service_account = "#{SOULs.configuration.app}@#{project_id}.iam.gserviceaccount.com"
15
15
  system(
16
16
  "gcloud pubsub subscriptions create #{options[:topic_name]}-sub \
17
17
  --topic #{options[:topic_name]} \
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class Pubsub < Thor
3
3
  desc "create_topic", "Create Google Cloud Pubsub Topic"
4
4
  method_option :topic_name,
@@ -1,4 +1,4 @@
1
- module Souls
1
+ module SOULs
2
2
  class CloudRun < Thor
3
3
  desc "list", "Show Google Cloud Run List"
4
4
  def list
@@ -1,9 +1,9 @@
1
- module Souls
1
+ module SOULs
2
2
  class CloudScheduler < Thor
3
3
  desc "awake", "Set Ping Every 15min by Google Cloud Scheduler"
4
4
  method_option :url, default: "https://souls.souls.nl", aliases: "--url", desc: "Set URL"
5
5
  def awake
6
- app_name = Souls.configuration.app
6
+ app_name = SOULs.configuration.app
7
7
  system(
8
8
  "gcloud scheduler jobs create http #{app_name}-awake
9
9
  --schedule '0,10,20,30,40,50 * * * *' --uri #{options[:url]} --http-method GET"
@@ -14,8 +14,8 @@ module Souls
14
14
  method_option :timezone, default: "Asia/Tokyo", aliases: "--timezone", desc: "Timezone e.g. Europe/Amsterdam"
15
15
  def sync_schedules
16
16
  require("./app")
17
- Souls::Gcloud.new.config_set
18
- project_id = Souls.configuration.project_id
17
+ SOULs::Gcloud.new.config_set
18
+ project_id = SOULs.configuration.project_id
19
19
 
20
20
  schedules_list = current_schedules
21
21
  worker_name = FileUtils.pwd.split("/").last