souls 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 426055d995980f34133e97a2bd481c333cb29e88f340d74c08b398e4570459c6
4
- data.tar.gz: b8266448605e3ae53cfe5eb3043e02d0e3e3ce0453fa3294388441f7f232adae
3
+ metadata.gz: 269a04ee109d531ce053a5ba46f4788fc6b2c8433fcf6d78ca81975d7b5f7422
4
+ data.tar.gz: 2bcc81f7b1d43809a69c9c1cb5900e64e82ece344bdca6dc7aefc4f8ce6048d8
5
5
  SHA512:
6
- metadata.gz: ba35b4d0cf88fd3266700dac70bad5171fb8027f5c67de9d488afe083f64032eba3ce868b19c29e086f2e981b42d79cd71ff2812a3da145712610dafa08901df
7
- data.tar.gz: e1370b953c6d64db731826c3a59525bbbfced8148ed1c6ffe7ddb40e75f3ce0ae020c83de8793d4df0f76509cb9e5eb6322a4525d67d0ed431dc1b3e13c6d564
6
+ metadata.gz: 6830ab031284b259dbc2031abaaf2af608cd526682a0f61739a08094916b326846333a6389df8dd5dcabb6c82775a3ace22d7f687ebf278f5043287692321ab1
7
+ data.tar.gz: de3e153a9c119cf41d244f8d6be83f83405c31414bb7e04c1bdbce367874e15bc0ac3d2a1894747bc591cc8cfa6d517e191cddc97b201af8fdfd49575883906b
@@ -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)
@@ -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,13 +96,13 @@ 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")
105
+ params = Souls.get_relation_params(class_name: class_name, col: "mutation")
106
106
  params[:params] < { column_name: "id", type: "string", array: false }
107
107
  File.open(file_path, "w") do |f|
108
108
  f.write(<<~TEXT)
@@ -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
@@ -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.6".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.4.5
1
+ 1.4.6
@@ -1 +1 @@
1
- 1.4.5
1
+ 1.4.6
metadata CHANGED
@@ -1,7 +1,7 @@
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.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI