souls 1.4.5 → 1.4.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 426055d995980f34133e97a2bd481c333cb29e88f340d74c08b398e4570459c6
4
- data.tar.gz: b8266448605e3ae53cfe5eb3043e02d0e3e3ce0453fa3294388441f7f232adae
3
+ metadata.gz: f159ec39740149805ab3222852310ad895b7fa6e8965d512878c60a74017edea
4
+ data.tar.gz: d003d33d6645e3cc829c2cbcd7f0aab8b381ac137e59910945845213051c7e9f
5
5
  SHA512:
6
- metadata.gz: ba35b4d0cf88fd3266700dac70bad5171fb8027f5c67de9d488afe083f64032eba3ce868b19c29e086f2e981b42d79cd71ff2812a3da145712610dafa08901df
7
- data.tar.gz: e1370b953c6d64db731826c3a59525bbbfced8148ed1c6ffe7ddb40e75f3ce0ae020c83de8793d4df0f76509cb9e5eb6322a4525d67d0ed431dc1b3e13c6d564
6
+ metadata.gz: af9a2de84bd19519bd97eaf61859381325cb92a0eeb750f1a1e3ef51068e9c53baa76de8db89f2ebc10b2cb964fe568e0d4b7a6b4536317f1d0e3cfb95ab718b
7
+ data.tar.gz: daa282e0403f4f35ff22b3154091ab8c00c0bcf586a832d2fd0f4ceeeb39fe0080f680c21744ae980a3f3335e33bd12d3028023700563eb302ae380f88e47fe4
data/README.md CHANGED
@@ -4,6 +4,9 @@
4
4
  <a aria-label="Ruby logo" href="https://el-soul.com">
5
5
  <img src="https://badgen.net/badge/icon/Made%20by%20ELSOUL?icon=ruby&label&color=black&labelColor=black">
6
6
  </a>
7
+ <a href="https://twitter.com/intent/follow?screen_name=SOULsOpenSource">
8
+ <img src="https://img.shields.io/twitter/follow/SOULsOpenSource.svg?label=Follow%20@SOULsOpenSource" alt="Follow @SOULsOpenSource" />
9
+ </a>
7
10
  <br/>
8
11
 
9
12
  <a aria-label="Ruby Gem version" href="https://rubygems.org/gems/souls">
@@ -12,24 +12,24 @@ module Souls
12
12
  app = Souls.configuration.app
13
13
  port = 3000 + workers.size
14
14
  souls_worker_name = "souls-#{app}-#{options[:name]}"
15
- download_worker(options[:name])
16
- souls_conf_update(souls_worker_name)
17
- souls_conf_update(souls_worker_name, "api")
18
- workflow(options[:name])
19
- procfile(options[:name], port)
20
- mother_procfile(options[:name])
21
- souls_config_init(options[:name])
22
- steepfile(options[:name])
23
- souls_helper_rbs(options[:name])
15
+ download_worker(worker_name: options[:name])
16
+ souls_conf_update(worker_name: souls_worker_name)
17
+ souls_conf_update(worker_name: souls_worker_name, strain: "api")
18
+ workflow(worker_name: options[:name])
19
+ procfile(worker_name: options[:name], port: port)
20
+ mother_procfile(worker_name: options[:name])
21
+ souls_config_init(worker_name: options[:name])
22
+ steepfile(worker_name: options[:name])
23
+ souls_helper_rbs(worker_name: options[:name])
24
24
  system("cd apps/#{options[:name]} && bundle")
25
- souls_worker_credit(options[:name])
25
+ souls_worker_credit(worker_name: options[:name])
26
26
  end
27
27
  true
28
28
  end
29
29
 
30
30
  private
31
31
 
32
- def steepfile(worker_name)
32
+ def steepfile(worker_name: "mailer")
33
33
  file_path = "./Steepfile"
34
34
 
35
35
  write_txt = ""
@@ -48,21 +48,21 @@ module Souls
48
48
  File.open(file_path, "w") { |f| f.write(write_txt) }
49
49
  end
50
50
 
51
- def procfile(worker_name, port)
51
+ def procfile(worker_name: "mailer", port: 123)
52
52
  file_path = "apps/#{worker_name}/Procfile.dev"
53
53
  File.open(file_path, "w") do |f|
54
54
  f.write("#{worker_name}: bundle exec puma -p #{port} -e development")
55
55
  end
56
56
  end
57
57
 
58
- def mother_procfile(worker_name)
58
+ def mother_procfile(worker_name: "mailer")
59
59
  file_path = "Procfile.dev"
60
60
  File.open(file_path, "a") do |f|
61
61
  f.write("\n#{worker_name}: foreman start -f ./apps/#{worker_name}/Procfile.dev")
62
62
  end
63
63
  end
64
64
 
65
- def souls_conf_update(worker_name, strain = "mother")
65
+ def souls_conf_update(worker_name: "mailer", strain: "mother")
66
66
  workers = Souls.configuration.workers
67
67
  port = 3000 + workers.size
68
68
  file_path = strain == "mother" ? "config/souls.rb" : "apps/api/config/souls.rb"
@@ -104,7 +104,7 @@ end
104
104
  File.open(file_path, "w") { |f| f.write(write_txt) }
105
105
  end
106
106
 
107
- def workflow(worker_name)
107
+ def workflow(worker_name: "mailer")
108
108
  file_dir = ".github/workflows"
109
109
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
110
110
  file_path = "#{file_dir}/#{worker_name}.yml"
@@ -204,7 +204,7 @@ end
204
204
  file_path
205
205
  end
206
206
 
207
- def souls_config_init(worker_name)
207
+ def souls_config_init(worker_name: "mailer")
208
208
  app_name = Souls.configuration.app
209
209
  project_id = Souls.configuration.project_id
210
210
  config_dir = "apps/#{worker_name}/config"
@@ -228,7 +228,7 @@ end
228
228
  puts(e)
229
229
  end
230
230
 
231
- def souls_helper_rbs(worker_name)
231
+ def souls_helper_rbs(worker_name: "mailer")
232
232
  file_dir = "./sig/#{worker_name}/app/utils"
233
233
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
234
234
  file_path = "#{file_dir}/souls_helper.rbs"
@@ -269,7 +269,7 @@ end
269
269
  end
270
270
  end
271
271
 
272
- def download_worker(worker_name)
272
+ def download_worker(worker_name: "mailer")
273
273
  version = Souls.get_latest_version_txt(service_name: "worker").join(".")
274
274
  file_name = "worker-v#{version}.tgz"
275
275
  url = "https://storage.googleapis.com/souls-bucket/boilerplates/workers/#{file_name}"
@@ -280,7 +280,7 @@ end
280
280
  FileUtils.rm(file_name)
281
281
  end
282
282
 
283
- def souls_worker_credit(worker_name)
283
+ def souls_worker_credit(worker_name: "mailer")
284
284
  line = Paint["====================================", :yellow]
285
285
  puts("\n")
286
286
  puts(line)
@@ -85,7 +85,7 @@ module Souls
85
85
  end
86
86
 
87
87
  def network_list
88
- system("gcloud compute network list")
88
+ system("gcloud compute networks list")
89
89
  end
90
90
 
91
91
  def nat_credit
@@ -102,7 +102,7 @@ module Souls
102
102
 
103
103
  def set_gh_secret_json
104
104
  file_path = "config/keyfile.json"
105
- system("gh secret set GCP_SA_KEY < #{file_path}")
105
+ system("gh secret set SOULS_GCP_SA_KEY < #{file_path}")
106
106
  FileUtils.rm(file_path)
107
107
  end
108
108
  end
@@ -2,9 +2,10 @@ 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"
5
- method_option :root_password, default: "", aliases: "--root-password", desc: "Set Cloud SQL Root Password"
6
5
  method_option :mysql, type: :boolean, default: false, aliases: "--mysql", desc: "Set Cloud SQL Type to MySQL"
7
6
  def create_instance
7
+ prompt = TTY::Prompt.new
8
+ password = prompt.mask("Set DB PassWord:")
8
9
  app_name = Souls.configuration.app
9
10
  project_id = Souls.configuration.project_id
10
11
  instance_name = Souls.configuration.instance_name if instance_name.blank?
@@ -15,14 +16,14 @@ module Souls
15
16
  system(
16
17
  "gcloud sql instances create #{instance_name} \
17
18
  --database-version=#{db_type} --cpu=1 --memory=3750MB --zone=#{zone} \
18
- --root-password='#{options[:root_password]}' --database-flags cloudsql.iam_authentication=on"
19
+ --root-password='#{password}' --database-flags cloudsql.iam_authentication=on"
19
20
  )
20
21
  Dir.chdir(Souls.get_api_path.to_s) do
21
22
  file_path = ".env"
22
23
  File.open(file_path, "w") do |line|
23
24
  line.write(<<~TEXT)
24
25
  SOULS_DB_HOST=#{get_sql_ip.strip}
25
- SOULS_DB_PW=#{options[:root_password]}
26
+ SOULS_DB_PW=#{password}
26
27
  SOULS_DB_USER=postgres
27
28
  SOULS_GCP_PROJECT_ID=#{project_id}
28
29
  SOULS_SECRET_KEY_BASE="#{SecureRandom.base64(64)}"
@@ -10,10 +10,10 @@ module Souls
10
10
  file_path = "./app/graphql/mutations/base/#{singularized_class_name}/create_#{singularized_class_name}.rb"
11
11
  return "Mutation already exist! #{file_path}" if File.exist?(file_path)
12
12
 
13
- create_mutation(singularized_class_name)
14
- update_mutation(singularized_class_name)
15
- delete_mutation(singularized_class_name)
16
- destroy_delete_mutation(singularized_class_name)
13
+ create_mutation(class_name: singularized_class_name)
14
+ update_mutation(class_name: singularized_class_name)
15
+ delete_mutation(class_name: singularized_class_name)
16
+ destroy_delete_mutation(class_name: singularized_class_name)
17
17
  end
18
18
  rescue Thor::Error => e
19
19
  raise(Thor::Error, e)
@@ -21,14 +21,14 @@ module Souls
21
21
 
22
22
  private
23
23
 
24
- def create_mutation(class_name)
24
+ def create_mutation(class_name: "user")
25
25
  singularized_class_name = class_name.singularize.underscore
26
26
  file_dir = "./app/graphql/mutations/base/#{singularized_class_name}"
27
27
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
28
28
  file_path = "#{file_dir}/create_#{singularized_class_name}.rb"
29
29
  raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
30
30
 
31
- params = Souls.get_relation_params(singularized_class_name, "mutation")
31
+ params = Souls.get_relation_params(class_name: singularized_class_name, col: "mutation")
32
32
  File.open(file_path, "a") do |f|
33
33
  f.write(<<~TEXT)
34
34
  module Mutations
@@ -91,14 +91,14 @@ module Souls
91
91
  file_path
92
92
  end
93
93
 
94
- def update_mutation(class_name)
94
+ def update_mutation(class_name: "user")
95
95
  singularized_class_name = class_name.singularize.underscore
96
96
  file_dir = "./app/graphql/mutations/base/#{singularized_class_name}"
97
97
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
98
98
  file_path = "#{file_dir}/update_#{singularized_class_name}.rb"
99
99
  raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
100
100
 
101
- params = Souls.get_relation_params(singularized_class_name, "mutation")
101
+ params = Souls.get_relation_params(class_name: singularized_class_name, col: "mutation")
102
102
  File.open(file_path, "w") do |f|
103
103
  f.write(<<~TEXT)
104
104
  module Mutations
@@ -165,7 +165,7 @@ module Souls
165
165
  end
166
166
 
167
167
  # 3. Mutation - Delete
168
- def delete_mutation(class_name)
168
+ def delete_mutation(class_name: "user")
169
169
  file_path = "./app/graphql/mutations/base/#{class_name}/delete_#{class_name}.rb"
170
170
  return "Mutation already exist! #{file_path}" if File.exist?(file_path)
171
171
 
@@ -195,7 +195,7 @@ module Souls
195
195
  end
196
196
 
197
197
  # 4. Mutation - Destroy Delete
198
- def destroy_delete_mutation(class_name)
198
+ def destroy_delete_mutation(class_name: "user")
199
199
  file_path = "./app/graphql/mutations/base/#{class_name}/destroy_delete_#{class_name}.rb"
200
200
  return "Mutation already exist! #{file_path}" if File.exist?(file_path)
201
201
 
@@ -3,17 +3,17 @@ module Souls
3
3
  desc "mutation_rbs [CLASS_NAME]", "Generate GraphQL Mutation RBS from schema.rb"
4
4
  def mutation_rbs(class_name)
5
5
  singularized_class_name = class_name.underscore.singularize
6
- create_rbs_mutation(singularized_class_name)
7
- update_rbs_mutation(singularized_class_name)
8
- delete_rbs_mutation(singularized_class_name)
9
- destroy_delete_rbs_mutation(singularized_class_name)
6
+ create_rbs_mutation(class_name: singularized_class_name)
7
+ update_rbs_mutation(class_name: singularized_class_name)
8
+ delete_rbs_mutation(class_name: singularized_class_name)
9
+ destroy_delete_rbs_mutation(class_name: singularized_class_name)
10
10
  rescue Thor::Error => e
11
11
  raise(Thor::Error, e)
12
12
  end
13
13
 
14
14
  private
15
15
 
16
- def create_rbs_mutation(class_name)
16
+ def create_rbs_mutation(class_name: "user")
17
17
  file_path = ""
18
18
  Dir.chdir(Souls.get_mother_path.to_s) do
19
19
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
@@ -21,7 +21,7 @@ module Souls
21
21
  file_path = "#{file_dir}/create_#{class_name}.rbs"
22
22
  raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
23
23
 
24
- params = Souls.get_relation_params(class_name, "mutation")
24
+ params = Souls.get_relation_params(class_name: class_name, col: "mutation")
25
25
  File.open(file_path, "w") do |f|
26
26
  f.write(<<~TEXT)
27
27
  class Boolean
@@ -96,14 +96,14 @@ module Souls
96
96
  raise(Thor::Error, e)
97
97
  end
98
98
 
99
- def update_rbs_mutation(class_name)
99
+ def update_rbs_mutation(class_name: "user")
100
100
  file_path = ""
101
101
  Dir.chdir(Souls.get_mother_path.to_s) do
102
102
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
103
103
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
104
104
  file_path = "#{file_dir}/update_#{class_name}.rbs"
105
- params = Souls.get_relation_params(class_name, "mutation")
106
- params[:params] < { column_name: "id", type: "string", array: false }
105
+ params = Souls.get_relation_params(class_name: class_name, col: "mutation")
106
+ params[:params] << { column_name: "id", type: "string", array: false }
107
107
  File.open(file_path, "w") do |f|
108
108
  f.write(<<~TEXT)
109
109
  module Mutations
@@ -175,7 +175,7 @@ module Souls
175
175
  file_path
176
176
  end
177
177
 
178
- def delete_rbs_mutation(class_name)
178
+ def delete_rbs_mutation(class_name: "user")
179
179
  file_path = ""
180
180
  Dir.chdir(Souls.get_mother_path.to_s) do
181
181
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
@@ -206,7 +206,7 @@ module Souls
206
206
  raise(Thor::Error, e)
207
207
  end
208
208
 
209
- def destroy_delete_rbs_mutation(class_name)
209
+ def destroy_delete_rbs_mutation(class_name: "user")
210
210
  file_path = ""
211
211
  Dir.chdir(Souls.get_mother_path.to_s) do
212
212
  file_dir = "./sig/api/app/graphql/mutations/base/#{class_name}"
@@ -10,7 +10,7 @@ module Souls
10
10
  file_path = "#{file_dir}/#{singularized_class_name}_type.rbs"
11
11
  raise(Thor::Error, "Type RBS already exist! #{file_path}") if File.exist?(file_path)
12
12
 
13
- params = Souls.get_relation_params(singularized_class_name)
13
+ params = Souls.get_relation_params(class_name: singularized_class_name)
14
14
  File.open(file_path, "w") do |f|
15
15
  f.write(<<~TEXT)
16
16
  module Types
@@ -33,6 +33,7 @@ module Souls
33
33
  puts("before build")
34
34
  system("rake build")
35
35
  system("rake release")
36
+ system("gsutil cp -r coverage gs://souls-bucket/souls-coverage")
36
37
  Whirly.status = Paint["soul-v#{souls_new_ver} successfully updated!"]
37
38
  end
38
39
  end
@@ -11,8 +11,8 @@ module Souls
11
11
  raise Souls::CLIException.new("File #{file_path} is missing. Please recreate it and then run this command again.") unless
12
12
  File.exist? file_path
13
13
 
14
- mutation_argument = check_mutation_argument(class_name, "create")
15
- overwrite_class_file(mutation_argument, file_path, new_cols)
14
+ mutation_argument = check_mutation_argument(class_name: "user", action: "create")
15
+ overwrite_class_file(mutation_argument: mutation_argument, file_path: file_path, new_cols: new_cols)
16
16
  puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
17
17
  end
18
18
 
@@ -25,15 +25,15 @@ module Souls
25
25
  raise Souls::CLIException.new("File #{file_path} is missing. Please recreate it and then run this command again.") unless
26
26
  File.exist? file_path
27
27
 
28
- mutation_argument = check_mutation_argument(class_name, "update")
29
- overwrite_class_file(mutation_argument, file_path, new_cols)
28
+ mutation_argument = check_mutation_argument(class_name: class_name, action: "update")
29
+ overwrite_class_file(mutation_argument: mutation_argument, file_path: file_path, new_cols: new_cols)
30
30
 
31
31
  puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
32
32
  end
33
33
 
34
34
  private
35
35
 
36
- def overwrite_class_file(mutation_argument, file_path, new_cols)
36
+ def overwrite_class_file(mutation_argument: "arg", file_path: "path", new_cols: 1)
37
37
  write_txt = String.new
38
38
  File.open(file_path, "r") do |f|
39
39
  f.each_line do |line|
@@ -55,7 +55,7 @@ module Souls
55
55
  File.open(file_path, "w") { |f| f.write(write_txt) }
56
56
  end
57
57
 
58
- def check_mutation_argument(class_name, action)
58
+ def check_mutation_argument(class_name: "user", action: "action")
59
59
  singularized_class_name = class_name.singularize.underscore
60
60
  dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
61
61
  file_path = "#{dir_name}/#{action}_#{singularized_class_name}.rb"
@@ -111,7 +111,7 @@ module Souls
111
111
  end
112
112
  end
113
113
 
114
- def get_relation_params(class_name, col = "")
114
+ def get_relation_params(class_name: "user", col: "")
115
115
  Dir.chdir(Souls.get_api_path.to_s) do
116
116
  cols =
117
117
  if col == "mutation"
@@ -129,7 +129,7 @@ module Souls
129
129
  end
130
130
  end
131
131
 
132
- def get_columns_num(class_name)
132
+ def get_columns_num(class_name: "user")
133
133
  pluralized_class_name = class_name.pluralize
134
134
  file_path = "./db/schema.rb"
135
135
  class_check_flag = false
@@ -149,7 +149,7 @@ module Souls
149
149
  cols
150
150
  end
151
151
 
152
- def get_columns_num_no_timestamp(class_name)
152
+ def get_columns_num_no_timestamp(class_name: "user")
153
153
  pluralized_class_name = class_name.pluralize
154
154
  file_path = "./db/schema.rb"
155
155
  class_check_flag = false
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.4.5".freeze
2
+ VERSION = "1.4.9".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.4.5
1
+ 1.4.9
@@ -1 +1 @@
1
- 1.4.5
1
+ 1.4.9
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
8
8
  - KishiTheMechanic
9
9
  - James Neve
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
13
  date: 2021-11-08 00:00:00.000000000 Z
@@ -232,7 +232,7 @@ metadata:
232
232
  homepage_uri: https://souls.elsoul.nl
233
233
  source_code_uri: https://github.com/elsoul/souls
234
234
  changelog_uri: https://github.com/elsoul/souls
235
- post_install_message:
235
+ post_install_message:
236
236
  rdoc_options: []
237
237
  require_paths:
238
238
  - lib
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubygems_version: 3.2.22
251
- signing_key:
251
+ signing_key:
252
252
  specification_version: 4
253
253
  summary: Build Serverless Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep,
254
254
  Active Record, RSpec, RuboCop, and Google Cloud.