souls 0.39.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/souls +8 -1
- data/lib/souls/cli/sync/index.rb +2 -0
- data/lib/souls/cli/sync/pubsub.rb +72 -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: 1fbe1578d6e8e0cb026243d7796df2e826a3c8850151de318170f8a80afb2879
|
4
|
+
data.tar.gz: 5b22531a5e03fcd18494ff61e0cfc28e6699ef7a5b526c91c04450d5a9db62af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dfdb6a0bf05853ded99da0a75f73005f02129ba78c5c23dabd58c6e8073d7d04a74fb0f9fb50fbe4c6d5ecbb7015da57005059aac89ecb70a435c9145db7b74
|
7
|
+
data.tar.gz: aab8c8adb4ef5da4f0855a9b3d4aa9f5a3244a1f17228754d64daf4c2232466e6fcba0e700a3ab6162b68222af33045c4f38fa15acfddc93e83ab756ba3737a2
|
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])
|
data/lib/souls/cli/sync/index.rb
CHANGED
@@ -0,0 +1,72 @@
|
|
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
|
+
puts("Topics in project:")
|
16
|
+
topic_names =
|
17
|
+
topics.map do |topic|
|
18
|
+
topic.name.gsub("projects/#{project_id}/topics/", "")
|
19
|
+
end
|
20
|
+
|
21
|
+
topic_names.each do |name|
|
22
|
+
value = workers[name.to_sym] || 0
|
23
|
+
workers[name.to_sym] = value - 1
|
24
|
+
end
|
25
|
+
|
26
|
+
workers.each do |key, value|
|
27
|
+
create_topic(topic_id: key) if value == 1
|
28
|
+
delete_topic(topic_id: key) if value == -1
|
29
|
+
end
|
30
|
+
workers
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_topic(topic_id: "mailer")
|
34
|
+
pubsub = Google::Cloud::Pubsub.new
|
35
|
+
topic = pubsub.create_topic(topic_id)
|
36
|
+
puts("Topic #{topic.name} created.")
|
37
|
+
end
|
38
|
+
|
39
|
+
def delete_topic(topic_id: "mailer")
|
40
|
+
pubsub = Google::Cloud::Pubsub.new
|
41
|
+
topic = pubsub.topic(topic_id)
|
42
|
+
topic.delete
|
43
|
+
puts("Topic #{topic_id} deleted.")
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_workers
|
47
|
+
require("#{Souls.get_mother_path}/config/souls")
|
48
|
+
worker_paths = Souls.configuration.workers.map { |n| n[:name] }
|
49
|
+
response = {}
|
50
|
+
Dir.chdir(Souls.get_mother_path.to_s) do
|
51
|
+
worker_paths.each do |worker|
|
52
|
+
mailers =
|
53
|
+
Dir["apps/#{worker}/app/graphql/mutations/mailers/*.rb"].map do |file|
|
54
|
+
file.gsub("apps/#{worker}/app/graphql/mutations/mailers/", "").gsub(".rb", "")
|
55
|
+
end
|
56
|
+
|
57
|
+
workers =
|
58
|
+
Dir["apps/#{worker}/app/graphql/mutations/*.rb"].map do |file|
|
59
|
+
file.gsub("apps/#{worker}/app/graphql/mutations/", "").gsub(".rb", "")
|
60
|
+
end
|
61
|
+
workers.delete("base_mutation")
|
62
|
+
local_files = mailers + workers
|
63
|
+
local_files.each do |file|
|
64
|
+
response[:"#{worker}_#{file}"] = 1
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
response
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.19.0
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.19.0
|
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.0
|
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
|