souls 0.68.0 → 0.68.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 344ff76de6a0a8d6c520215f572455bcb0f83131e636c0b0fd8ecb2fd6f31255
4
- data.tar.gz: 18be246dcd49f8b2863861b588c6066361fe984d73a22180c883b33e32e0eb0b
3
+ metadata.gz: 6f0ecf3c4d7ed19f71c77c666d6a04136607799edf909212cb5a36f7cc4a0d43
4
+ data.tar.gz: d139a13a4bfa5017e0a359308abfdeb61ead755548c43264ce34d83c901d6442
5
5
  SHA512:
6
- metadata.gz: f937b45df604657f676dde4a085b9d572e03ed7afec4e6db30029f8c5bb3663bafe781b62428d8ee13fa4dc4b584d6602e95b036e932b5d57e62835e1d89d3d0
7
- data.tar.gz: c2777fda8e56d4decd0d732bd8758026332dcc5808a337a19e45d91b5f87a2c20f0510306b99decc11e6139551f65a681369bf5c62a036edb72418fc684c58b6
6
+ metadata.gz: 6343d5e59243629addafc281c618c9e3191c909096937525a90710be443315f1a672730b44e67cfc9d4252a1b173e4125a223c233466e52afa44f57bfd73620d
7
+ data.tar.gz: fdc1b3ad6fb2a74c957c18e927a045d9d63418e9e979040ba86b5d79d6f46e406feee139816113e0ebbef7b7485bd07259a90bc55b6db050a5bec86d8c89494d
@@ -12,9 +12,8 @@ module Souls
12
12
  private
13
13
 
14
14
  def get_topics(workers: {})
15
- app_name = Souls.configuration.app
16
15
  project_id = Souls.configuration.project_id
17
- pubsub = Google::Cloud::Pubsub.new(project_id: ENV["PROJECT_ID"])
16
+ pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
18
17
  topics = pubsub.topics
19
18
 
20
19
  topic_names =
@@ -22,7 +21,7 @@ module Souls
22
21
  topic.name.gsub("projects/#{project_id}/topics/", "")
23
22
  end
24
23
 
25
- souls_topics = topic_names.select { |n| n.include?("souls_#{app_name}_") }
24
+ souls_topics = topic_names.select { |n| n.include?("souls_") }
26
25
 
27
26
  souls_topics.each do |name|
28
27
  value = workers[name.to_sym] || 0
@@ -40,17 +39,16 @@ module Souls
40
39
  end
41
40
 
42
41
  def create_topic(topic_id: "mailer")
43
- app_name = Souls.configuration.app
44
- pubsub = Google::Cloud::Pubsub.new(project_id: ENV["PROJECT_ID"])
45
- topic_name = "souls_#{app_name}_#{topic_id}"
46
- topic = pubsub.create_topic(topic_name.to_s)
42
+ project_id = Souls.configuration.project_id
43
+ pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
44
+ topic = pubsub.create_topic(topic_id.to_s)
47
45
  puts("Topic #{topic.name} created.")
48
46
  end
49
47
 
50
48
  def delete_topic(topic_id: "mailer")
51
- app_name = Souls.configuration.app
52
- pubsub = Google::Cloud::Pubsub.new(project_id: ENV["PROJECT_ID"])
53
- topic_name = "souls_#{app_name}_#{topic_id}"
49
+ project_id = Souls.configuration.project_id
50
+ pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
51
+ topic_name = "#{topic_id}_sub"
54
52
  topic = pubsub.topic(topic_name.to_s)
55
53
  topic.delete
56
54
  puts("Topic #{topic_name} deleted.")
@@ -58,18 +56,17 @@ module Souls
58
56
 
59
57
  def create_push_subscription(topic_id: "mailer")
60
58
  require("#{Souls.get_mother_path}/config/souls")
61
- app_name = Souls.configuration.app
62
- topic_name = "souls_#{app_name}_#{topic_id}"
63
- worker_name = topic_id.split("_")[0]
59
+ worker_name = topic_id.split("_")[1]
64
60
 
65
- subscription_id = "#{topic_name}_sub"
61
+ subscription_id = "#{topic_id}_sub"
66
62
  endpoint = ""
67
63
  worker_paths = Souls.configuration.workers
68
64
  worker_paths.each do |worker|
69
65
  endpoint = worker[:endpoint] if worker[:name] == worker_name
70
66
  end
71
67
 
72
- pubsub = Google::Cloud::Pubsub.new(project_id: ENV["PROJECT_ID"])
68
+ project_id = Souls.configuration.project_id
69
+ pubsub = Google::Cloud::Pubsub.new(project_id: project_id)
73
70
 
74
71
  topic = pubsub.topic(topic_name)
75
72
  sub = topic.subscribe(subscription_id, endpoint: endpoint, deadline: 20)
@@ -83,19 +80,13 @@ module Souls
83
80
  response = {}
84
81
  Dir.chdir(Souls.get_mother_path.to_s) do
85
82
  worker_paths.each do |worker|
86
- mailers =
87
- Dir["apps/#{worker}/app/graphql/mutations/mailers/*.rb"].map do |file|
88
- file.gsub("apps/#{worker}/app/graphql/mutations/mailers/", "").gsub(".rb", "")
89
- end
90
-
91
83
  workers =
92
84
  Dir["apps/#{worker}/app/graphql/mutations/*.rb"].map do |file|
93
85
  file.gsub("apps/#{worker}/app/graphql/mutations/", "").gsub(".rb", "")
94
86
  end
95
87
  workers.delete("base_mutation")
96
- local_files = mailers + workers
97
- local_files.each do |file|
98
- response[:"#{worker}_#{file}"] = 1
88
+ workers.each do |file|
89
+ response[:"souls_#{worker}_#{file}"] = 1
99
90
  end
100
91
  end
101
92
  end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.68.0".freeze
2
+ VERSION = "0.68.1".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.47.0
1
+ 0.47.1
@@ -1 +1 @@
1
- 0.47.0
1
+ 0.47.1
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.68.0
4
+ version: 0.68.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI