souls 1.19.6 → 1.19.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/souls/app/utils/painter.rb +18 -6
- data/lib/souls/cli/sync/pubsub.rb +22 -14
- 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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7397cc9eb56f0420edff1764b05af2411bc28df50fcaacf53e1babc6af2531d1
|
4
|
+
data.tar.gz: fb3283fb3e09e06e1e37f00870f9d9f577fac509cd2564d2f97cf9be0d614f37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c164ae100be15a59717e16d991f8fb4ce3520eca314a16d3e82dfd6f54b87eed01ea99efd56a86e8d6a68cedc9999b103713696ae06f395f8898597ccd2b34f
|
7
|
+
data.tar.gz: ecbb2177e6ba224cea34fba5b8f7af6951c8dbfdc49a45e60f33d3df7e60fb7c9c6b3051733cba703c784e6af4fcc43d5f173c60afd56350c4b3b653cb8d4f50
|
@@ -13,16 +13,28 @@ module SOULs
|
|
13
13
|
puts(Paint % ["✓ %{white_text}", :red, { white_text: ["Deleted file #{text}", :white] }])
|
14
14
|
end
|
15
15
|
|
16
|
-
def error(text)
|
17
|
-
|
16
|
+
def error(text, emoji = nil)
|
17
|
+
if emoji
|
18
|
+
puts(Paint["#{emoji} #{text}", :red])
|
19
|
+
else
|
20
|
+
puts(Paint["🚨 #{text}", :red])
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
|
-
def warning(text)
|
21
|
-
|
24
|
+
def warning(text, emoji = nil)
|
25
|
+
if emoji
|
26
|
+
puts(Paint["#{emoji} #{text}", :yellow])
|
27
|
+
else
|
28
|
+
puts(Paint["🚨 #{text}", :yellow])
|
29
|
+
end
|
22
30
|
end
|
23
31
|
|
24
|
-
def success(text)
|
25
|
-
|
32
|
+
def success(text, emoji = nil)
|
33
|
+
if emoji
|
34
|
+
puts(Paint["#{emoji} #{text}", :green])
|
35
|
+
else
|
36
|
+
puts(Paint["🎉 #{text}", :green])
|
37
|
+
end
|
26
38
|
end
|
27
39
|
|
28
40
|
def sync(text)
|
@@ -15,15 +15,14 @@ module SOULs
|
|
15
15
|
return false if url.blank?
|
16
16
|
|
17
17
|
worker_file_names = get_workers_file_paths
|
18
|
-
return false if worker_file_names.blank?
|
19
18
|
|
20
|
-
sync_pubsub_topics_and_subscriptions(
|
19
|
+
sync_pubsub_topics_and_subscriptions(worker_file_names: worker_file_names, worker_url: url)
|
21
20
|
SOULs::Painter.sync("All Jobs with PubSub Subscription!")
|
22
21
|
end
|
23
22
|
|
24
23
|
private
|
25
24
|
|
26
|
-
def sync_pubsub_topics_and_subscriptions(worker_url:,
|
25
|
+
def sync_pubsub_topics_and_subscriptions(worker_url:, worker_file_names: {})
|
27
26
|
project_id = SOULs.configuration.project_id
|
28
27
|
pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
|
29
28
|
topics = pubsub.topics
|
@@ -38,20 +37,29 @@ module SOULs
|
|
38
37
|
|
39
38
|
souls_topics.each do |name|
|
40
39
|
file_name = name.gsub("-", "_")
|
41
|
-
value =
|
42
|
-
|
40
|
+
value = worker_file_names[file_name.to_sym] || 0
|
41
|
+
worker_file_names[file_name.to_sym] = value - 1
|
43
42
|
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
if worker_file_names.blank?
|
45
|
+
return if souls_topics.blank?
|
46
|
+
|
47
|
+
souls_topics.each do |topic_id|
|
48
|
+
delete_topic(topic_id: topic_id)
|
49
|
+
delete_subscription(topic_id: topic_id)
|
50
|
+
end
|
51
|
+
else
|
52
|
+
worker_file_names.each do |key, value|
|
53
|
+
topic_id = key.to_s.gsub("_", "-")
|
54
|
+
if value == 1
|
55
|
+
create_topic(topic_id: topic_id)
|
56
|
+
create_push_subscription(worker_url: worker_url, topic_id: topic_id)
|
57
|
+
end
|
58
|
+
delete_topic(topic_id: topic_id) if value == -1
|
59
|
+
delete_subscription(topic_id: topic_id) if value == -1
|
50
60
|
end
|
51
|
-
delete_topic(topic_id: topic_id) if value == -1
|
52
|
-
delete_subscription(topic_id: topic_id) if value == -1
|
53
61
|
end
|
54
|
-
|
62
|
+
worker_file_names
|
55
63
|
end
|
56
64
|
|
57
65
|
def create_topic(topic_id: "worker-mailer")
|
@@ -66,7 +74,7 @@ module SOULs
|
|
66
74
|
pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
|
67
75
|
topic = pubsub.topic(topic_id.to_s)
|
68
76
|
topic.delete
|
69
|
-
SOULs::Painter.
|
77
|
+
SOULs::Painter.warning("Topic #{topic_id} deleted.", "✨")
|
70
78
|
end
|
71
79
|
|
72
80
|
def delete_subscription(topic_id: "worker-mailer")
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.19.
|
1
|
+
1.19.7
|
@@ -1 +1 @@
|
|
1
|
-
1.19.
|
1
|
+
1.19.7
|