souls 0.38.6 → 0.40.2
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 +8 -1
- data/lib/souls/cli/gcloud/compute/index.rb +3 -3
- data/lib/souls/cli/sync/index.rb +2 -0
- data/lib/souls/cli/sync/pubsub.rb +92 -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
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 830e9f1e9796eb865775399585c85ff3185a4896e43d815507db9b0a5774ab08
|
4
|
+
data.tar.gz: 41296eeb3bab8cb8e300625cf881f270cd526cbaf4f169eb74316e623910d8fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 998fdb38f2a8aa35557ab76a28992098e279ae8a2b8662348fe1b536389b7013302e544d583fdf75fd5d158c403c73e57b737d368806d8ece693e04855fe3d31
|
7
|
+
data.tar.gz: c646f6a1f8b6c558b4717ee1da213f9d613e5396523b56247bd545ff3d2510dc3620d71a6997523653c0fb3b6c3c364626db92ad27138999ab1d70df1d233617
|
data/exe/souls
CHANGED
@@ -142,7 +142,14 @@ begin
|
|
142
142
|
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
143
143
|
Whirly.status = status
|
144
144
|
Souls::Sync.model
|
145
|
-
Whirly.status = Paint["API and
|
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]
|
146
153
|
end
|
147
154
|
else
|
148
155
|
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
@@ -105,9 +105,9 @@ module Souls
|
|
105
105
|
|
106
106
|
Edit `.github/workflow/worker.yml`
|
107
107
|
|
108
|
-
Add these 2 options in `- name: Deploy to Cloud Run` step
|
109
|
-
--vpc-connector=#{app_name}-connector \
|
110
|
-
--vpc-egress=all \
|
108
|
+
Add these 2 options in \n`- name: Deploy to Cloud Run` step
|
109
|
+
\n--vpc-connector=#{app_name}-connector \
|
110
|
+
\n--vpc-egress=all \
|
111
111
|
|
112
112
|
TEXT
|
113
113
|
cd = Paint[endroll, :white]
|
data/lib/souls/cli/sync/index.rb
CHANGED
@@ -0,0 +1,92 @@
|
|
1
|
+
module Souls
|
2
|
+
module Sync
|
3
|
+
class << self
|
4
|
+
def pubsub
|
5
|
+
get_topics(workers: get_workers)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def get_topics(workers: {})
|
11
|
+
project_id = Souls.configuration.project_id
|
12
|
+
pubsub = Google::Cloud::Pubsub.new
|
13
|
+
topics = pubsub.topics
|
14
|
+
|
15
|
+
topic_names =
|
16
|
+
topics.map do |topic|
|
17
|
+
topic.name.gsub("projects/#{project_id}/topics/", "")
|
18
|
+
end
|
19
|
+
|
20
|
+
topic_names.each do |name|
|
21
|
+
value = workers[name.to_sym] || 0
|
22
|
+
workers[name.to_sym] = value - 1
|
23
|
+
end
|
24
|
+
|
25
|
+
workers.each do |key, value|
|
26
|
+
if value == 1
|
27
|
+
create_topic(topic_id: key)
|
28
|
+
create_push_subscription(topic_id: key)
|
29
|
+
end
|
30
|
+
delete_topic(topic_id: key) if value == -1
|
31
|
+
end
|
32
|
+
workers
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_topic(topic_id: "mailer")
|
36
|
+
pubsub = Google::Cloud::Pubsub.new
|
37
|
+
topic = pubsub.create_topic(topic_id)
|
38
|
+
puts("Topic #{topic.name} created.")
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete_topic(topic_id: "mailer")
|
42
|
+
pubsub = Google::Cloud::Pubsub.new
|
43
|
+
topic = pubsub.topic(topic_id)
|
44
|
+
topic.delete
|
45
|
+
puts("Topic #{topic_id} deleted.")
|
46
|
+
end
|
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
|
+
|
66
|
+
def get_workers
|
67
|
+
require("#{Souls.get_mother_path}/config/souls")
|
68
|
+
worker_paths = Souls.configuration.workers.map { |n| n[:name] }
|
69
|
+
response = {}
|
70
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
71
|
+
worker_paths.each do |worker|
|
72
|
+
mailers =
|
73
|
+
Dir["apps/#{worker}/app/graphql/mutations/mailers/*.rb"].map do |file|
|
74
|
+
file.gsub("apps/#{worker}/app/graphql/mutations/mailers/", "").gsub(".rb", "")
|
75
|
+
end
|
76
|
+
|
77
|
+
workers =
|
78
|
+
Dir["apps/#{worker}/app/graphql/mutations/*.rb"].map do |file|
|
79
|
+
file.gsub("apps/#{worker}/app/graphql/mutations/", "").gsub(".rb", "")
|
80
|
+
end
|
81
|
+
workers.delete("base_mutation")
|
82
|
+
local_files = mailers + workers
|
83
|
+
local_files.each do |file|
|
84
|
+
response[:"#{worker}_#{file}"] = 1
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
response
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.19.2
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.19.2
|
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.40.2
|
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-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.87.2
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: google-cloud-pubsub
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.8.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.8.0
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: paint
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,6 +154,7 @@ files:
|
|
140
154
|
- lib/souls/cli/release/release.rb
|
141
155
|
- lib/souls/cli/sync/index.rb
|
142
156
|
- lib/souls/cli/sync/model.rb
|
157
|
+
- lib/souls/cli/sync/pubsub.rb
|
143
158
|
- lib/souls/cli/upgrade/gem_update.rb
|
144
159
|
- lib/souls/cli/upgrade/index.rb
|
145
160
|
- lib/souls/index.rb
|