souls 0.40.1 → 0.41.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/exe/souls +6 -18
- data/lib/souls/cli/gcloud/run/index.rb +1 -1
- data/lib/souls/cli/gcloud/sql/index.rb +12 -0
- data/lib/souls/cli/sync/conf.rb +46 -0
- data/lib/souls/cli/sync/index.rb +1 -0
- data/lib/souls/cli/sync/pubsub.rb +22 -1
- 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
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9901b40b4c239bbf4963bddaa54b6211f12f60b5a780e409e25f34e43280a46b
|
4
|
+
data.tar.gz: 3937e60d4e0f2799cbae53c2c4e9662c135e5529636dd234d0cffbc9a71bafd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23ed2a5788d0c0aefdb596eff5a102f62189a0780925576a5dd51c275d65b06100d7a7e60922a6b17a91443c6bc15ec85888b796c097595da2d4d99465908c09
|
7
|
+
data.tar.gz: a6746ef6153e4c62a2b7f8f3d07b681970d20431b18db35c2d8738dd7ada78f630e742b378ca3d158e7296cffd61fcee1ad7b0698c64c312a8cb0689c63b1cb6
|
data/exe/souls
CHANGED
@@ -135,24 +135,12 @@ begin
|
|
135
135
|
when "release"
|
136
136
|
Souls::Release.gem_release
|
137
137
|
when "sync"
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
status =
|
142
|
-
|
143
|
-
|
144
|
-
Souls::Sync.model
|
145
|
-
Whirly.status = Paint["API and Workers Models Synced!", :green]
|
146
|
-
end
|
147
|
-
when "pubsub"
|
148
|
-
status = Paint["Syncing PubSub...", :yellow]
|
149
|
-
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
150
|
-
Whirly.status = status
|
151
|
-
Souls::Sync.pubsub
|
152
|
-
Whirly.status = Paint["Workers and Google Cloud PubSub Synced!", :green]
|
153
|
-
end
|
154
|
-
else
|
155
|
-
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
138
|
+
method_name = ARGV[1]
|
139
|
+
status = Paint["Syncing Files...", :yellow]
|
140
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
141
|
+
Whirly.status = status
|
142
|
+
Souls::Sync.public_send(method_name)
|
143
|
+
Whirly.status = Paint["Synced!", :green]
|
156
144
|
end
|
157
145
|
when "create"
|
158
146
|
service_name = ARGV[1]
|
@@ -10,6 +10,18 @@ module Souls
|
|
10
10
|
--root-password='#{root_pass}' --database-flags cloudsql.iam_authentication=on"
|
11
11
|
)
|
12
12
|
end
|
13
|
+
|
14
|
+
def pathch_instance(instance_name: "")
|
15
|
+
app_name = Souls.configuration.app
|
16
|
+
instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
|
17
|
+
project_id = Souls.configuration.project_id
|
18
|
+
system(
|
19
|
+
"gcloud beta sql instances patch #{instance_name} \
|
20
|
+
--project=#{project_id} \
|
21
|
+
--network=#{app_name} \
|
22
|
+
--no-assign-ip"
|
23
|
+
)
|
24
|
+
end
|
13
25
|
end
|
14
26
|
end
|
15
27
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Souls
|
2
|
+
module Sync
|
3
|
+
class << self
|
4
|
+
def conf
|
5
|
+
update_conf
|
6
|
+
update_conf(strain: "api")
|
7
|
+
end
|
8
|
+
|
9
|
+
def update_conf(strain: "mother")
|
10
|
+
workers = Souls.configuration.workers
|
11
|
+
file_path = strain == "mother" ? "config/souls.rb" : "apps/api/config/souls.rb"
|
12
|
+
new_file_path = "souls.rb"
|
13
|
+
worker_switch = false
|
14
|
+
File.open(new_file_path, "w") do |new_line|
|
15
|
+
File.open(file_path, "r") do |f|
|
16
|
+
f.each_line do |line|
|
17
|
+
worker_switch = true if line.include?("config.workers")
|
18
|
+
next if line.strip == "end"
|
19
|
+
|
20
|
+
new_line.write(line) unless worker_switch
|
21
|
+
|
22
|
+
next unless worker_switch
|
23
|
+
|
24
|
+
new_line.write(" config.workers = [\n")
|
25
|
+
workers.each do |worker|
|
26
|
+
endpoint = Souls::Gcloud::Run.get_endpoint(worker_name: worker[:name])
|
27
|
+
new_line.write(<<-TEXT)
|
28
|
+
{
|
29
|
+
name: "#{worker[:name]}",
|
30
|
+
endpoint: "#{endpoint}/endpoint",
|
31
|
+
port: #{worker[:port]}
|
32
|
+
},
|
33
|
+
TEXT
|
34
|
+
end
|
35
|
+
break
|
36
|
+
end
|
37
|
+
end
|
38
|
+
new_line.write(<<-TEXT)
|
39
|
+
]
|
40
|
+
end
|
41
|
+
TEXT
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/souls/cli/sync/index.rb
CHANGED
@@ -23,7 +23,10 @@ module Souls
|
|
23
23
|
end
|
24
24
|
|
25
25
|
workers.each do |key, value|
|
26
|
-
|
26
|
+
if value == 1
|
27
|
+
create_topic(topic_id: key)
|
28
|
+
create_push_subscription(topic_id: key)
|
29
|
+
end
|
27
30
|
delete_topic(topic_id: key) if value == -1
|
28
31
|
end
|
29
32
|
workers
|
@@ -42,6 +45,24 @@ module Souls
|
|
42
45
|
puts("Topic #{topic_id} deleted.")
|
43
46
|
end
|
44
47
|
|
48
|
+
def create_push_subscription(topic_id: "mailer")
|
49
|
+
require("#{Souls.get_mother_path}/config/souls")
|
50
|
+
worker_name = topic_id.split("_")[0]
|
51
|
+
|
52
|
+
subscription_id = "#{topic_id}-sub"
|
53
|
+
endpoint = ""
|
54
|
+
worker_paths = Souls.configuration.workers
|
55
|
+
worker_paths.each do |worker|
|
56
|
+
endpoint = worker[:endpoint] if worker[:name] == worker_name
|
57
|
+
end
|
58
|
+
|
59
|
+
pubsub = Google::Cloud::Pubsub.new
|
60
|
+
|
61
|
+
topic = pubsub.topic(topic_id)
|
62
|
+
topic.subscribe(subscription_id, endpoint: endpoint)
|
63
|
+
puts("Push subscription #{subscription_id} created.")
|
64
|
+
end
|
65
|
+
|
45
66
|
def get_workers
|
46
67
|
require("#{Souls.get_mother_path}/config/souls")
|
47
68
|
worker_paths = Souls.configuration.workers.map { |n| n[:name] }
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.20.1
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.20.1
|
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: 0.
|
4
|
+
version: 0.41.1
|
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-09-04 00:00:00.000000000 Z
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/souls/cli/index.rb
|
153
153
|
- lib/souls/cli/release/index.rb
|
154
154
|
- lib/souls/cli/release/release.rb
|
155
|
+
- lib/souls/cli/sync/conf.rb
|
155
156
|
- lib/souls/cli/sync/index.rb
|
156
157
|
- lib/souls/cli/sync/model.rb
|
157
158
|
- lib/souls/cli/sync/pubsub.rb
|
@@ -174,7 +175,7 @@ metadata:
|
|
174
175
|
homepage_uri: https://souls.elsoul.nl
|
175
176
|
source_code_uri: https://github.com/elsoul/souls
|
176
177
|
changelog_uri: https://github.com/elsoul/souls
|
177
|
-
post_install_message:
|
178
|
+
post_install_message:
|
178
179
|
rdoc_options: []
|
179
180
|
require_paths:
|
180
181
|
- lib
|
@@ -190,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
191
|
version: '0'
|
191
192
|
requirements: []
|
192
193
|
rubygems_version: 3.2.22
|
193
|
-
signing_key:
|
194
|
+
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
|
196
197
|
クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
|