souls 1.19.5 → 1.19.9
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/index.rb +0 -1
- data/lib/souls/cli/sync/pubsub.rb +26 -16
- 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.rb +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47404f43681adfd3c3ee24a1bcec31e7e538f944d4b55b6d43b2024888a9a169
|
4
|
+
data.tar.gz: b883f0d9337e02c3ffc75ec982a156f393618b752991a256303975e80130f362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 414619b49aa78b8e735705ee0e4b278d1159345a652d386bbe3cd19f80b6997584968110ce3fee19f6b135b289d0a5544cd1d774b83303dc5d1d0deab3d7e6aa
|
7
|
+
data.tar.gz: 6c98c7ca8c8ac5ed740649dfecb5ab899571b2421d95c5840e68087b1c4fc24aa32b239fbad6989d51afe787b5424a5c6c6cb5d3c0fda98b795cb2a5b6d173d1
|
@@ -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)
|
data/lib/souls/cli/sync/index.rb
CHANGED
@@ -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
|
@@ -37,20 +36,31 @@ module SOULs
|
|
37
36
|
souls_topics = topic_names.select { |n| n.include?("souls-#{worker_name}") }
|
38
37
|
|
39
38
|
souls_topics.each do |name|
|
40
|
-
|
41
|
-
|
39
|
+
file_name = name.underscore
|
40
|
+
value = worker_file_names[file_name.to_sym] || 0
|
41
|
+
worker_file_names[file_name.to_sym] = value - 1
|
42
42
|
end
|
43
|
+
puts(worker_file_names)
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
if worker_file_names.blank?
|
46
|
+
return if souls_topics.blank?
|
47
|
+
|
48
|
+
souls_topics.each do |topic_id|
|
49
|
+
delete_topic(topic_id: topic_id)
|
50
|
+
delete_subscription(topic_id: topic_id)
|
51
|
+
end
|
52
|
+
else
|
53
|
+
worker_file_names.each do |key, value|
|
54
|
+
topic_id = key.to_s.gsub("_", "-")
|
55
|
+
if value == 1
|
56
|
+
create_topic(topic_id: topic_id)
|
57
|
+
create_push_subscription(worker_url: worker_url, topic_id: topic_id)
|
58
|
+
end
|
59
|
+
delete_topic(topic_id: topic_id) if value == -1
|
60
|
+
delete_subscription(topic_id: topic_id) if value == -1
|
49
61
|
end
|
50
|
-
delete_topic(topic_id: topic_id) if value == -1
|
51
|
-
delete_subscription(topic_id: topic_id) if value == -1
|
52
62
|
end
|
53
|
-
|
63
|
+
worker_file_names
|
54
64
|
end
|
55
65
|
|
56
66
|
def create_topic(topic_id: "worker-mailer")
|
@@ -65,7 +75,7 @@ module SOULs
|
|
65
75
|
pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
|
66
76
|
topic = pubsub.topic(topic_id.to_s)
|
67
77
|
topic.delete
|
68
|
-
SOULs::Painter.
|
78
|
+
SOULs::Painter.warning("Topic #{topic_id} deleted.", "✨")
|
69
79
|
end
|
70
80
|
|
71
81
|
def delete_subscription(topic_id: "worker-mailer")
|
@@ -79,7 +89,7 @@ module SOULs
|
|
79
89
|
def create_push_subscription(worker_url:, topic_id: "worker-mailer")
|
80
90
|
souls_endpoint = SOULs.configuration.endpoint
|
81
91
|
subscription_id = "#{topic_id}-sub"
|
82
|
-
endpoint = "#{worker_url}
|
92
|
+
endpoint = "#{worker_url}#{souls_endpoint}"
|
83
93
|
|
84
94
|
project_id = SOULs.configuration.project_id
|
85
95
|
pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
|
@@ -99,7 +109,7 @@ module SOULs
|
|
99
109
|
end
|
100
110
|
workers.delete("base_query")
|
101
111
|
workers.each do |file|
|
102
|
-
response[
|
112
|
+
response["souls_#{worker_name.underscore}_#{file}".to_sym] = 1
|
103
113
|
end
|
104
114
|
response
|
105
115
|
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.19.
|
1
|
+
1.19.9
|
@@ -1 +1 @@
|
|
1
|
-
1.19.
|
1
|
+
1.19.9
|
data/lib/souls.rb
CHANGED
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: 1.19.
|
4
|
+
version: 1.19.9
|
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: 2022-01-
|
13
|
+
date: 2022-01-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -124,6 +124,20 @@ dependencies:
|
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: 0.3.0
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: httpclient
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 2.8.3
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 2.8.3
|
127
141
|
- !ruby/object:Gem::Dependency
|
128
142
|
name: thor
|
129
143
|
requirement: !ruby/object:Gem::Requirement
|