souls 1.19.4 → 1.19.8
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/create/templates/go/function.rb +1 -2
- data/lib/souls/cli/create/templates/nodejs/index.rb +1 -2
- data/lib/souls/cli/create/templates/python/main.rb +1 -2
- data/lib/souls/cli/gcloud/index.rb +1 -0
- data/lib/souls/cli/sync/index.rb +0 -1
- data/lib/souls/cli/sync/pubsub.rb +25 -15
- 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 +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bfb5aba9ee1c61c94280607df87f643dca9ca4b24a97ad098d005d10ccad65f
|
4
|
+
data.tar.gz: 801641e0e9bb8fff4908f4b3febfd0f8024b836b3a16f338b2cafd1f6728aeba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eea9d1f2ce11a802eb81cfe5b43bf1db40baed767dce82da0d9fc4f845a6ed26972fcc9808a904dfdab4ec0ff9787b28a5e902cf15f7eb521f950ca4fbb56a46
|
7
|
+
data.tar.gz: 38b3bea572fd8792b7e1a67e2d12930d86637aad9ea45bfeb233e89b3c1b6753212971dae8018001a7dd4f7162509b6afa0e8954a40a5d396c8abdb6858ca23c
|
@@ -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)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Template
|
2
2
|
module Go
|
3
3
|
def self.function(file_name)
|
4
|
-
file_name.underscore.camelize
|
5
4
|
<<~APP
|
6
5
|
// Package p contains an HTTP Cloud Function.
|
7
6
|
package p
|
@@ -17,7 +16,7 @@ module Template
|
|
17
16
|
|
18
17
|
// HelloWorld prints the JSON encoded "message" field in the body
|
19
18
|
// of the request or "Hello, World!" if there isn't one.
|
20
|
-
func #{file_name}(w http.ResponseWriter, r *http.Request) {
|
19
|
+
func #{file_name.underscore.camelize}(w http.ResponseWriter, r *http.Request) {
|
21
20
|
var d struct {
|
22
21
|
Message string `json:"message"`
|
23
22
|
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Template
|
2
2
|
module Nodejs
|
3
3
|
def self.index(file_name)
|
4
|
-
file_name.underscore.camelize(:lower)
|
5
4
|
<<~APP
|
6
5
|
const express = require('express');
|
7
6
|
const bodyParser = require('body-parser');
|
@@ -20,7 +19,7 @@ module Template
|
|
20
19
|
app.post('/souls-functions-post', (req, res)=>{
|
21
20
|
res.json(req.body)
|
22
21
|
});
|
23
|
-
exports.#{file_name} = app;
|
22
|
+
exports.#{file_name.underscore.camelize(:lower)} = app;
|
24
23
|
APP
|
25
24
|
end
|
26
25
|
end
|
@@ -63,6 +63,7 @@ module SOULs
|
|
63
63
|
system("gcloud services enable translate.googleapis.com")
|
64
64
|
system("gcloud services enable firestore.googleapis.com")
|
65
65
|
system("gcloud services enable cloudfunctions.googleapis.com")
|
66
|
+
system("gcloud services enable cloudbuild.googleapis.com")
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
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)
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.19.
|
1
|
+
1.19.8
|
@@ -1 +1 @@
|
|
1
|
-
1.19.
|
1
|
+
1.19.8
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -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
|