souls 0.40.2 → 0.41.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 830e9f1e9796eb865775399585c85ff3185a4896e43d815507db9b0a5774ab08
4
- data.tar.gz: 41296eeb3bab8cb8e300625cf881f270cd526cbaf4f169eb74316e623910d8fd
3
+ metadata.gz: fa53fbf9c79d49d1d58e132b0dee2b5ddc8ea26b6f0c8175e6358080907b53e9
4
+ data.tar.gz: 0cfca344f041fcd6f41428909dce517b432fd4e4cedb5751a6d10b45c7b8d5e1
5
5
  SHA512:
6
- metadata.gz: 998fdb38f2a8aa35557ab76a28992098e279ae8a2b8662348fe1b536389b7013302e544d583fdf75fd5d158c403c73e57b737d368806d8ece693e04855fe3d31
7
- data.tar.gz: c646f6a1f8b6c558b4717ee1da213f9d613e5396523b56247bd545ff3d2510dc3620d71a6997523653c0fb3b6c3c364626db92ad27138999ab1d70df1d233617
6
+ metadata.gz: 80ec7918fb52d203d9dfb87c1c326f9f90acd83d24055efa824061477b82177030fe7793c25ceaf736f2acbe9a7bb824c5e99400154a36bae3ca38979152cad0
7
+ data.tar.gz: ee25cb4b3ae05f1af3c4b075678e50c70c1244ea320cd0826503fb15d5f83580c4d9a91a11d7e8dcf8ea25caf8f83d868d2f3dcffe07790939362816960327c7
data/exe/souls CHANGED
@@ -135,24 +135,12 @@ begin
135
135
  when "release"
136
136
  Souls::Release.gem_release
137
137
  when "sync"
138
- target = ARGV[1]
139
- case target
140
- when "model", "m"
141
- status = Paint["Syncing Models...", :yellow]
142
- Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
143
- Whirly.status = status
144
- Souls::Sync.model
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]
153
- end
154
- else
155
- puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
138
+ method_name = ARGV[1]
139
+ status = Paint["Syncing Files...", :yellow]
140
+ Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
141
+ Whirly.status = status
142
+ Souls::Sync.public_send(method_name)
143
+ Whirly.status = Paint["Synced!", :green]
156
144
  end
157
145
  when "create"
158
146
  service_name = ARGV[1]
@@ -2,7 +2,7 @@ module Souls
2
2
  module Gcloud
3
3
  module Run
4
4
  class << self
5
- def awake(app_name: "souls-app", url: "")
5
+ def awake(app_name: "", url: "")
6
6
  app_name = Souls.configuration.app if app_name.blank?
7
7
  system(
8
8
  "gcloud scheduler jobs create http #{app_name}-awake
@@ -10,6 +10,18 @@ module Souls
10
10
  --root-password='#{root_pass}' --database-flags cloudsql.iam_authentication=on"
11
11
  )
12
12
  end
13
+
14
+ def pathch_instance(instance_name: "")
15
+ app_name = Souls.configuration.app
16
+ instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
17
+ project_id = Souls.configuration.project_id
18
+ system(
19
+ "gcloud beta sql instances patch #{instance_name} \
20
+ --project=#{project_id} \
21
+ --network=#{app_name} \
22
+ --no-assign-ip"
23
+ )
24
+ end
13
25
  end
14
26
  end
15
27
  end
@@ -0,0 +1,46 @@
1
+ module Souls
2
+ module Sync
3
+ class << self
4
+ def conf
5
+ update_conf
6
+ update_conf(strain: "api")
7
+ end
8
+
9
+ def update_conf(strain: "mother")
10
+ workers = Souls.configuration.workers
11
+ file_path = strain == "mother" ? "config/souls.rb" : "apps/api/config/souls.rb"
12
+ new_file_path = "souls.rb"
13
+ worker_switch = false
14
+ File.open(new_file_path, "w") do |new_line|
15
+ File.open(file_path, "r") do |f|
16
+ f.each_line do |line|
17
+ worker_switch = true if line.include?("config.workers")
18
+ next if line.strip == "end"
19
+
20
+ new_line.write(line) unless worker_switch
21
+
22
+ next unless worker_switch
23
+
24
+ new_line.write(" config.workers = [\n")
25
+ workers.each do |worker|
26
+ endpoint = Souls::Gcloud::Run.get_endpoint(worker_name: worker[:name])
27
+ new_line.write(<<-TEXT)
28
+ {
29
+ name: "#{worker[:name]}",
30
+ endpoint: "#{endpoint}/endpoint",
31
+ port: #{worker[:port]}
32
+ },
33
+ TEXT
34
+ end
35
+ break
36
+ end
37
+ end
38
+ new_line.write(<<-TEXT)
39
+ ]
40
+ end
41
+ TEXT
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,3 +1,4 @@
1
1
  require "google/cloud/pubsub"
2
2
  require_relative "./model"
3
3
  require_relative "./pubsub"
4
+ require_relative "./conf"
@@ -24,10 +24,10 @@ module Souls
24
24
 
25
25
  workers.each do |key, value|
26
26
  if value == 1
27
- create_topic(topic_id: key)
28
- create_push_subscription(topic_id: key)
27
+ create_topic(topic_id: key.to_s)
28
+ create_push_subscription(topic_id: key.to_s)
29
29
  end
30
- delete_topic(topic_id: key) if value == -1
30
+ delete_topic(topic_id: key.to_s) if value == -1
31
31
  end
32
32
  workers
33
33
  end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.40.2".freeze
2
+ VERSION = "0.41.2".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.19.2
1
+ 0.20.2
@@ -1 +1 @@
1
- 0.19.2
1
+ 0.20.2
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.40.2
4
+ version: 0.41.2
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-04 00:00:00.000000000 Z
13
+ date: 2021-09-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -152,6 +152,7 @@ files:
152
152
  - lib/souls/cli/index.rb
153
153
  - lib/souls/cli/release/index.rb
154
154
  - lib/souls/cli/release/release.rb
155
+ - lib/souls/cli/sync/conf.rb
155
156
  - lib/souls/cli/sync/index.rb
156
157
  - lib/souls/cli/sync/model.rb
157
158
  - lib/souls/cli/sync/pubsub.rb