souls 0.58.3 → 0.60.0

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: f7a256a7ea37aaad89e76c32abad7e7c0232eb21c627e03f00f14ab02f2d2d37
4
- data.tar.gz: 11506d1ba70570d6e5e7114e80b01aff816f905ae2c1c8edd4efc9299cf8bcf8
3
+ metadata.gz: 70d25691a6e93376b3393efc7b95c0585995bf1611cce81b463a4db3f17497ca
4
+ data.tar.gz: 0a1fe1bcc547ad5c41d85a5bf814157f171eb5aec5f8b1ce5f847bf509a6a6fd
5
5
  SHA512:
6
- metadata.gz: dd8c451629c39b3f6978946e74c5442f914c9c4d824abc1fd47e3a99fb5e99147ada481f066aa32887ab03f4ebbdfc6751df2faf06e37b756cfe372b19ba09ba
7
- data.tar.gz: 795154142df5e334a7f66df0912216540a3ac0c713aa88061ef684e9bdf9835c132c7596936a68d8f0eb331b42abf4b209923e27f24359df58271f5eac7aab34
6
+ metadata.gz: 01fdbaa3e67ed0cfc1d4a78c56e55046f4e3bf3c413e7170eefb9b2ffb661cd86721140553e01807a9fe82db553003c7b108b90081ec9ca77b336e70c579577c
7
+ data.tar.gz: 8d83326353d091c5655ff463ee1d7e72582d8a66be7c40567206811b3b4b1a4f25c2796ec3362fa01f7142b8651f60a60c76cd4852e6b4032f3cabc49102bf08
@@ -12,7 +12,7 @@ module Souls
12
12
  f.write(<<~TEXT)
13
13
  module Types
14
14
  class #{singularized_class_name.camelize}Connection < Types::BaseConnection
15
- def edge_type: (*untyped) -> untyped
15
+ def self.edge_type: (*untyped) -> untyped
16
16
  end
17
17
  end
18
18
  TEXT
@@ -31,6 +31,7 @@ module Souls
31
31
  TEXT
32
32
  end
33
33
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
34
+ Souls::Generate.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
34
35
  file_path
35
36
  rescue Thor::Error => e
36
37
  raise(Thor::Error, e)
@@ -0,0 +1,32 @@
1
+ module Souls
2
+ class Generate < Thor
3
+ desc "manager_rbs [CLASS_NAME]", "Generate SOULs Manager RBS Template"
4
+ method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
5
+ def manager_rbs(class_name)
6
+ file_path = ""
7
+ singularized_class_name = class_name.underscore.singularize
8
+ file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
9
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
+ file_path = "#{file_dir}/#{options[:mutation]}.rbs"
11
+ File.open(file_path, "w") do |f|
12
+ f.write(<<~TEXT)
13
+ module Mutations
14
+ module Managers
15
+ module #{singularized_class_name.camelize}Manager
16
+ class #{singularized_class_name.camelize}Login
17
+ def self.description: (String)-> untyped
18
+ def self.argument: (untyped, untyped, untyped)-> untyped
19
+ def self.field: (untyped, untyped, untyped)-> untyped
20
+ end
21
+ end
22
+ end
23
+ end
24
+ TEXT
25
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
26
+ end
27
+ file_path
28
+ rescue Thor::Error => e
29
+ raise(Thor::Error, e)
30
+ end
31
+ end
32
+ end
@@ -159,6 +159,7 @@ module Souls
159
159
  new_line.write(<<-TEXT)
160
160
 
161
161
  def resolve args
162
+ params = args.dup
162
163
  _, params[:id] = SoulsApiSchema.from_global_id(args[:id])
163
164
  TEXT
164
165
  end
@@ -131,10 +131,11 @@ module Souls
131
131
  type = Souls.type_check(param[:type])
132
132
  rbs_type = Souls.rbs_type_check(param[:type])
133
133
  type = "[#{type}]" if param[:array]
134
+ required = param[:column_name] == "id" ? "required: true" : "required: false"
134
135
  if i.zero?
135
- f.write(" def self.argument: (:#{param[:column_name]}, #{type}, required: false ) -> #{rbs_type}\n")
136
+ f.write(" def self.argument: (:#{param[:column_name]}, #{type}, #{required} ) -> #{rbs_type}\n")
136
137
  else
137
- f.write(" | (:#{param[:column_name]}, #{type}, required: false ) -> #{rbs_type}\n")
138
+ f.write(" | (:#{param[:column_name]}, #{type}, #{required} ) -> #{rbs_type}\n")
138
139
  end
139
140
  end
140
141
  end
@@ -34,6 +34,7 @@ module Souls
34
34
  Boolean: Boolean
35
35
  Integer: Integer
36
36
  end
37
+ end
37
38
  TEXT
38
39
  end
39
40
  end
@@ -21,13 +21,13 @@ module Souls
21
21
  end
22
22
  File.open(file_path, "a") do |f|
23
23
  params[:params].each_with_index do |param, i|
24
- type = Souls.rbs_type_check(param[:type])
24
+ type = Souls.type_check(param[:type])
25
25
  type = "[#{type}]" if param[:array]
26
26
  rbs_type = Souls.rbs_type_check(param[:type])
27
27
  if i.zero?
28
- f.write(" def self.field: (:#{param[:column_name]}, #{type}, null: false) -> #{rbs_type}\n")
28
+ f.write(" def self.field: (:#{param[:column_name]}, #{type}, null: true) -> #{rbs_type}\n")
29
29
  else
30
- f.write(" | (:#{param[:column_name]}, #{type}, null: false) -> #{rbs_type}\n")
30
+ f.write(" | (:#{param[:column_name]}, #{type}, null: true) -> #{rbs_type}\n")
31
31
  end
32
32
  end
33
33
  end
@@ -19,6 +19,9 @@ module Souls
19
19
  procfile(worker_name: options[:name], port: port)
20
20
  mother_procfile(worker_name: options[:name])
21
21
  souls_config_init(worker_name: options[:name])
22
+ steepfile(worker_name: options[:name])
23
+ souls_helper_rbs(worker_name: options[:name])
24
+ souls_worker_credit(worker_name: options[:name])
22
25
  end
23
26
  true
24
27
  rescue Thor::Error => e
@@ -27,6 +30,26 @@ module Souls
27
30
 
28
31
  private
29
32
 
33
+ def steepfile(worker_name: "mailer")
34
+ file_path = "./Steepfile"
35
+ new_file_path = "config/Steepfile"
36
+ File.open(new_file_path, "w") do |new_line|
37
+ File.open(file_path, "r") do |f|
38
+ f.each_line do |line|
39
+ case line.strip.to_s
40
+ when "end"
41
+ ["app", "db", "constants", "app.rb"].each do |path|
42
+ new_line.write(" check \"apps/#{worker_name}/#{path}\"\n")
43
+ end
44
+ new_line.write("end\n")
45
+ else
46
+ new_line.write(line)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
30
53
  def procfile(worker_name: "mailer", port: 3000)
31
54
  file_dir = "apps/#{worker_name}"
32
55
  file_path = "#{file_dir}/Procfile.dev"
@@ -212,6 +235,47 @@ end
212
235
  puts(e)
213
236
  end
214
237
 
238
+ def souls_helper_rbs(worker_name: "mailer")
239
+ file_dir = "./sig/#{worker_name}/app/utils/"
240
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
241
+ file_path = "#{file_dir}/souls_helper.rbs"
242
+ File.open(file_path, "w") do |f|
243
+ f.write(<<~TEXT)
244
+ module SoulsHelper
245
+ def self.export_csv: (untyped model_name) -> (String? | StandardError )
246
+ def self.export_model_to_csv: (untyped model_name) -> (untyped | StandardError )
247
+ def self.upload_to_gcs: (String file_path, String upload_path) -> untyped
248
+ def self.get_selenium_driver: (?:chrome mode) -> untyped
249
+ end
250
+ module CSV
251
+ def self.open: (*untyped){(untyped) -> nil} -> untyped
252
+ end
253
+ module Selenium
254
+ module WebDriver
255
+ def self.for: (*untyped) -> untyped
256
+ module Chrome
257
+ module Options
258
+ def self.new: ()-> untyped
259
+ end
260
+ end
261
+ module Remote
262
+ module Capabilities
263
+ def self.firefox: ()-> untyped
264
+ end
265
+ end
266
+ end
267
+ end
268
+ module Google
269
+ module Cloud
270
+ module Storage
271
+ def self.new: ()-> untyped
272
+ end
273
+ end
274
+ end
275
+ TEXT
276
+ end
277
+ end
278
+
215
279
  def download_worker(worker_name: "mailer")
216
280
  version = Souls.get_latest_version_txt(service_name: "worker").join(".")
217
281
  file_name = "worker-v#{version}.tgz"
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.58.3".freeze
2
+ VERSION = "0.60.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.37.3
1
+ 0.39.0
@@ -1 +1 @@
1
- 0.37.3
1
+ 0.39.0
@@ -1,2 +1,2 @@
1
- require_relative "./mailer"
2
1
  require_relative "./job"
2
+ require_relative "./job_rbs"
@@ -1,8 +1,14 @@
1
1
  module Souls
2
2
  class Generate < Thor
3
3
  desc "job [CLASS_NAME]", "Generate Job File in Worker"
4
+ method_option :mutation, type: :boolean, aliases: "--mailer", default: false, desc: "Mailer Option"
4
5
  def job(class_name)
5
- create_mutation(class_name: class_name)
6
+ if options[:mailer]
7
+ mailgun_mailer(class_name: class_name)
8
+ else
9
+ create_mutation(class_name: class_name)
10
+ end
11
+ Souls::Generate.new.invoke(:job_rbs, [class_name], {})
6
12
  rescue Thor::Error => e
7
13
  raise(Thor::Error, e)
8
14
  end
@@ -36,5 +42,44 @@ module Souls
36
42
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
37
43
  file_path
38
44
  end
45
+
46
+ def mailgun_mailer(class_name: "mailer")
47
+ file_dir = "./app/graphql/mutations/"
48
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
49
+ file_path = "#{file_dir}#{class_name.singularize}.rb"
50
+ raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
51
+
52
+ File.open(file_path, "w") do |f|
53
+ f.write(<<~TEXT)
54
+ module Mutations
55
+ class #{class_name.camelize} < BaseMutation
56
+ description "Mail を送信します。"
57
+ field :response, String, null: false
58
+
59
+ def resolve
60
+ # First, instantiate the Mailgun Client with your API key
61
+ mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
62
+
63
+ # Define your message parameters
64
+ message_params = {
65
+ from: "postmaster@YOUR-DOMAIN",
66
+ to: "sending@to.mail.com",
67
+ subject: "SOULs Mailer test!",
68
+ text: "It is really easy to send a message!"
69
+ }
70
+
71
+ # Send your message through the client
72
+ mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
73
+ { response: "Job done!" }
74
+ rescue StandardError => e
75
+ GraphQL::ExecutionError.new(e.to_s)
76
+ end
77
+ end
78
+ end
79
+ TEXT
80
+ end
81
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
82
+ file_path
83
+ end
39
84
  end
40
85
  end
@@ -0,0 +1,31 @@
1
+ module Souls
2
+ class Generate < Thor
3
+ desc "job_rbs [CLASS_NAME]", "Generate SOULs Job Mutation RBS Template"
4
+ def job_rbs(class_name)
5
+ file_path = ""
6
+ Dir.chdir(Souls.get_mother_path.to_s) do
7
+ singularized_class_name = class_name.underscore.singularize
8
+ file_dir = "./sig/#{singularized_class_name}/app/graphql/mutations/"
9
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
+ file_path = "#{file_dir}#{singularized_class_name}.rbs"
11
+ File.open(file_path, "w") do |f|
12
+ f.write(<<~TEXT)
13
+ module Types
14
+ module Mutations
15
+ String: String
16
+ class #{singularized_class_name.camelize} < BaseMutation
17
+ def self.description: (String) -> untyped
18
+ def self.field: (:response, String, null: false) -> untyped
19
+ end
20
+ end
21
+ end
22
+ TEXT
23
+ end
24
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
25
+ end
26
+ file_path
27
+ rescue Thor::Error => e
28
+ raise(Thor::Error, e)
29
+ end
30
+ end
31
+ end
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: 0.58.3
4
+ version: 0.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
@@ -134,6 +134,7 @@ files:
134
134
  - lib/souls/api/generate/edge_rbs.rb
135
135
  - lib/souls/api/generate/index.rb
136
136
  - lib/souls/api/generate/manager.rb
137
+ - lib/souls/api/generate/manager_rbs.rb
137
138
  - lib/souls/api/generate/model.rb
138
139
  - lib/souls/api/generate/model_rbs.rb
139
140
  - lib/souls/api/generate/mutation.rb
@@ -191,7 +192,7 @@ files:
191
192
  - lib/souls/versions/.souls_worker_version
192
193
  - lib/souls/worker/generate/index.rb
193
194
  - lib/souls/worker/generate/job.rb
194
- - lib/souls/worker/generate/mailer.rb
195
+ - lib/souls/worker/generate/job_rbs.rb
195
196
  - lib/souls/worker/index.rb
196
197
  homepage: https://souls.elsoul.nl
197
198
  licenses:
@@ -1,51 +0,0 @@
1
- module Souls
2
- class Generate < Thor
3
- desc "mailer [MAILER_NAME]", "Generate Mailer Template in Worker"
4
- def mailer(class_name)
5
- mailgun_mailer(class_name: class_name)
6
- rescue Thor::Error => e
7
- raise(Thor::Error, e)
8
- end
9
-
10
- private
11
-
12
- def mailgun_mailer(class_name: "mailer")
13
- file_dir = "./app/graphql/mutations/"
14
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
15
- file_path = "#{file_dir}#{class_name.singularize}.rb"
16
- raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
17
-
18
- File.open(file_path, "w") do |f|
19
- f.write(<<~TEXT)
20
- module Mutations
21
- class #{class_name.camelize} < BaseMutation
22
- description "Mail を送信します。"
23
- field :response, String, null: false
24
-
25
- def resolve
26
- # First, instantiate the Mailgun Client with your API key
27
- mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
28
-
29
- # Define your message parameters
30
- message_params = {
31
- from: "postmaster@YOUR-DOMAIN",
32
- to: "sending@to.mail.com",
33
- subject: "SOULs Mailer test!",
34
- text: "It is really easy to send a message!"
35
- }
36
-
37
- # Send your message through the client
38
- mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
39
- { response: "Job done!" }
40
- rescue StandardError => e
41
- GraphQL::ExecutionError.new(e.to_s)
42
- end
43
- end
44
- end
45
- TEXT
46
- end
47
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
48
- file_path
49
- end
50
- end
51
- end