souls 0.42.0 → 0.44.1
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 +4 -4
- data/lib/souls/cli/create/index.rb +16 -12
- data/lib/souls/cli/sync/conf.rb +31 -25
- data/lib/souls/init.rb +2 -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/mailer.rb +20 -22
- data/lib/souls/worker/generate/mutation.rb +2 -2
- data/lib/souls.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5332b02ca046ad798b993475937f538d18af28d0e937fd0e7949410249e4c394
|
4
|
+
data.tar.gz: 6cce8d7bfb49388171ecc74b978a400da928231a23da6a43c320d746c53030eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f2a807f9a71fd245cf6b04ff646814a9ec677a85df5645fd827f8023dde60306a2f9f5ed0846abc7f1696b49a110d8e61267f6e0668cbffc97f9160d7dd1cc8
|
7
|
+
data.tar.gz: 984d551c3ebc578469d28edc6d6cde32c8b03484850f5108d5d54a3c49bf3e0e873a65cb6f300fa6c1acf85cf974bbef07abd9fbf003f433e3870582b8cc87c8
|
@@ -2,18 +2,21 @@ module Souls
|
|
2
2
|
module Create
|
3
3
|
class << self
|
4
4
|
def worker(worker_name: "mailer")
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
require("#{Souls.get_mother_path}/config/souls")
|
6
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
7
|
+
file_dir = "apps/#{worker_name}"
|
8
|
+
raise(StandardError, "Same Worker Already Exist!") if Dir.exist?(file_dir)
|
9
|
+
|
10
|
+
workers = Souls.configuration.workers
|
11
|
+
port = 3000 + workers.size
|
12
|
+
download_worker(worker_name: worker_name)
|
13
|
+
souls_conf_update(worker_name: worker_name)
|
14
|
+
souls_conf_update(worker_name: worker_name, strain: "api")
|
15
|
+
workflow(worker_name: worker_name)
|
16
|
+
procfile(worker_name: worker_name, port: port)
|
17
|
+
mother_procfile(worker_name: worker_name)
|
18
|
+
souls_config_init(worker_name: worker_name)
|
19
|
+
end
|
17
20
|
end
|
18
21
|
|
19
22
|
def procfile(worker_name: "mailer", port: 3000)
|
@@ -189,6 +192,7 @@ end
|
|
189
192
|
Souls.configure do |config|
|
190
193
|
config.app = "#{app_name}"
|
191
194
|
config.project_id = "#{project_id}"
|
195
|
+
config.endpoint = "/endpoint"
|
192
196
|
config.strain = "worker"
|
193
197
|
config.fixed_gems = ["excluded_gem"]
|
194
198
|
config.workers = []
|
data/lib/souls/cli/sync/conf.rb
CHANGED
@@ -7,38 +7,44 @@ module Souls
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def update_conf(strain: "mother")
|
10
|
+
require("#{Souls.get_mother_path}/config/souls")
|
10
11
|
workers = Souls.configuration.workers
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
File.open(
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
13
|
+
file_path = strain == "mother" ? "config/souls.rb" : "apps/api/config/souls.rb"
|
14
|
+
new_file_path = "souls.rb"
|
15
|
+
worker_switch = false
|
16
|
+
File.open(new_file_path, "w") do |new_line|
|
17
|
+
File.open(file_path, "r") do |f|
|
18
|
+
f.each_line do |line|
|
19
|
+
worker_switch = true if line.include?("config.workers")
|
20
|
+
next if line.strip == "end"
|
19
21
|
|
20
|
-
|
22
|
+
new_line.write(line) unless worker_switch
|
21
23
|
|
22
|
-
|
24
|
+
next unless worker_switch
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
new_line.write(" config.workers = [\n")
|
27
|
+
workers.each do |worker|
|
28
|
+
base_url = Souls::Gcloud::Run.get_endpoint(worker_name: worker[:name])
|
29
|
+
endpoint = Souls.configuration.endpoint
|
30
|
+
new_line.write(<<-TEXT)
|
31
|
+
{
|
32
|
+
name: "#{worker[:name]}",
|
33
|
+
endpoint: "#{base_url.strip}#{endpoint}",
|
34
|
+
port: #{worker[:port]}
|
35
|
+
},
|
36
|
+
TEXT
|
37
|
+
end
|
38
|
+
break
|
34
39
|
end
|
35
|
-
break
|
36
40
|
end
|
41
|
+
new_line.write(<<~TEXT)
|
42
|
+
]
|
43
|
+
end
|
44
|
+
TEXT
|
37
45
|
end
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
TEXT
|
46
|
+
FileUtils.rm(file_path)
|
47
|
+
FileUtils.mv(new_file_path, file_path)
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
data/lib/souls/init.rb
CHANGED
@@ -42,6 +42,7 @@ module Souls
|
|
42
42
|
Souls.configure do |config|
|
43
43
|
config.app = "#{app_name}"
|
44
44
|
config.project_id = "#{app_name}-project"
|
45
|
+
config.endpoint = "/endpoint"
|
45
46
|
config.strain = "api"
|
46
47
|
config.fixed_gems = ["excluded_gem"]
|
47
48
|
config.workers = []
|
@@ -71,6 +72,7 @@ module Souls
|
|
71
72
|
Souls.configure do |config|
|
72
73
|
config.app = "#{app_name}"
|
73
74
|
config.project_id = "#{app_name}-project"
|
75
|
+
config.endpoint = "/endpoint"
|
74
76
|
config.strain = "mother"
|
75
77
|
config.fixed_gems = ["excluded_gem"]
|
76
78
|
config.workers = []
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.23.1
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.23.1
|
@@ -13,37 +13,35 @@ module Souls
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def mailgun_mailer(class_name: "mailer")
|
16
|
-
file_dir = "./app/graphql/mutations/
|
16
|
+
file_dir = "./app/graphql/mutations/"
|
17
17
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
18
|
-
file_path = "#{file_dir}#{class_name.singularize}
|
18
|
+
file_path = "#{file_dir}#{class_name.singularize}.rb"
|
19
19
|
raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
|
20
20
|
|
21
21
|
File.open(file_path, "w") do |f|
|
22
22
|
f.write(<<~TEXT)
|
23
23
|
module Mutations
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
field :response, String, null: false
|
24
|
+
class #{class_name.camelize} < BaseMutation
|
25
|
+
description "Mail を送信します。"
|
26
|
+
field :response, String, null: false
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def resolve
|
29
|
+
# First, instantiate the Mailgun Client with your API key
|
30
|
+
mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
# Define your message parameters
|
33
|
+
message_params = {
|
34
|
+
from: "postmaster@YOUR-DOMAIN",
|
35
|
+
to: "sending@to.mail.com",
|
36
|
+
subject: "SOULs Mailer test!",
|
37
|
+
text: "It is really easy to send a message!"
|
38
|
+
}
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
40
|
+
# Send your message through the client
|
41
|
+
mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
|
42
|
+
{ response: "Job done!" }
|
43
|
+
rescue StandardError => e
|
44
|
+
GraphQL::ExecutionError.new(e.to_s)
|
47
45
|
end
|
48
46
|
end
|
49
47
|
TEXT
|
@@ -5,13 +5,13 @@ module Souls
|
|
5
5
|
def mutation(class_name: "csv_export")
|
6
6
|
file_dir = "./app/graphql/mutations/"
|
7
7
|
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
8
|
-
file_path = "#{file_dir}#{class_name.singularize}
|
8
|
+
file_path = "#{file_dir}#{class_name.singularize}.rb"
|
9
9
|
raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
|
10
10
|
|
11
11
|
File.open(file_path, "w") do |f|
|
12
12
|
f.write(<<~TEXT)
|
13
13
|
module Mutations
|
14
|
-
class #{class_name.camelize}
|
14
|
+
class #{class_name.camelize} < BaseMutation
|
15
15
|
description "Job Description"
|
16
16
|
field :response, String, null: false
|
17
17
|
|
data/lib/souls.rb
CHANGED
@@ -247,14 +247,13 @@ module Souls
|
|
247
247
|
end
|
248
248
|
|
249
249
|
class Configuration
|
250
|
-
attr_accessor :app, :strain, :project_id, :
|
250
|
+
attr_accessor :app, :strain, :project_id, :endpoint, :fixed_gems, :workers
|
251
251
|
|
252
252
|
def initialize
|
253
253
|
@app = nil
|
254
254
|
@project_id = nil
|
255
|
+
@endpoint = nil
|
255
256
|
@strain = nil
|
256
|
-
@github_repo = nil
|
257
|
-
@worker_endpoint = nil
|
258
257
|
@fixed_gems = nil
|
259
258
|
@workers = nil
|
260
259
|
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.
|
4
|
+
version: 0.44.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-09-
|
13
|
+
date: 2021-09-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|