souls 0.59.1 → 0.59.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/souls/api/generate/manager.rb +1 -0
- data/lib/souls/api/generate/manager_rbs.rb +32 -0
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- data/lib/souls/worker/generate/index.rb +0 -1
- data/lib/souls/worker/generate/job.rb +45 -1
- data/lib/souls/worker/generate/job_rbs.rb +0 -0
- metadata +3 -2
- data/lib/souls/worker/generate/mailer.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1034f25cfca4bc39ecf378335e4a42d9968c0f6e6e6489f68297c047954c1896
|
4
|
+
data.tar.gz: c7736a9966c434c866652ab3938d2c2abf9c11a7ed79ff5f02e8488e240a7e10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef7b5f771b35aa094f4fc65bc14cd927fde7aaf166c799a2e1164860bd1a96e9423b6c4e955166781fc5ac660d250748276b3d5627a7ea28ac8d5032400429d3
|
7
|
+
data.tar.gz: a345585731bd80f9ce3efb502d71afa1c3f5b0c3846fa64eb833051be6f673d4aa365396a73c2fd6dd1fa43cc15f6d8f7f111550ed9b22101d77cbc53c22e262
|
@@ -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
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.38.
|
1
|
+
0.38.2
|
@@ -1 +1 @@
|
|
1
|
-
0.38.
|
1
|
+
0.38.2
|
@@ -1,8 +1,13 @@
|
|
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
|
-
|
6
|
+
if options[:mailer]
|
7
|
+
mailgun_mailer(class_name: class_name)
|
8
|
+
else
|
9
|
+
create_mutation(class_name: class_name)
|
10
|
+
end
|
6
11
|
rescue Thor::Error => e
|
7
12
|
raise(Thor::Error, e)
|
8
13
|
end
|
@@ -36,5 +41,44 @@ module Souls
|
|
36
41
|
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
37
42
|
file_path
|
38
43
|
end
|
44
|
+
|
45
|
+
def mailgun_mailer(class_name: "mailer")
|
46
|
+
file_dir = "./app/graphql/mutations/"
|
47
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
48
|
+
file_path = "#{file_dir}#{class_name.singularize}.rb"
|
49
|
+
raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
|
50
|
+
|
51
|
+
File.open(file_path, "w") do |f|
|
52
|
+
f.write(<<~TEXT)
|
53
|
+
module Mutations
|
54
|
+
class #{class_name.camelize} < BaseMutation
|
55
|
+
description "Mail を送信します。"
|
56
|
+
field :response, String, null: false
|
57
|
+
|
58
|
+
def resolve
|
59
|
+
# First, instantiate the Mailgun Client with your API key
|
60
|
+
mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
|
61
|
+
|
62
|
+
# Define your message parameters
|
63
|
+
message_params = {
|
64
|
+
from: "postmaster@YOUR-DOMAIN",
|
65
|
+
to: "sending@to.mail.com",
|
66
|
+
subject: "SOULs Mailer test!",
|
67
|
+
text: "It is really easy to send a message!"
|
68
|
+
}
|
69
|
+
|
70
|
+
# Send your message through the client
|
71
|
+
mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
|
72
|
+
{ response: "Job done!" }
|
73
|
+
rescue StandardError => e
|
74
|
+
GraphQL::ExecutionError.new(e.to_s)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
TEXT
|
79
|
+
end
|
80
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
81
|
+
file_path
|
82
|
+
end
|
39
83
|
end
|
40
84
|
end
|
File without changes
|
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.59.
|
4
|
+
version: 0.59.2
|
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/
|
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
|