souls 0.41.2 → 0.43.0

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: fa53fbf9c79d49d1d58e132b0dee2b5ddc8ea26b6f0c8175e6358080907b53e9
4
- data.tar.gz: 0cfca344f041fcd6f41428909dce517b432fd4e4cedb5751a6d10b45c7b8d5e1
3
+ metadata.gz: 10295ad8cce6115a41b8d1dc02b3a4889df8bf4f798fdf19afec48020f9af866
4
+ data.tar.gz: 89f8bebc45e20ac5a0dac7130d4016afc4519f122addf443748495c5e4f1296a
5
5
  SHA512:
6
- metadata.gz: 80ec7918fb52d203d9dfb87c1c326f9f90acd83d24055efa824061477b82177030fe7793c25ceaf736f2acbe9a7bb824c5e99400154a36bae3ca38979152cad0
7
- data.tar.gz: ee25cb4b3ae05f1af3c4b075678e50c70c1244ea320cd0826503fb15d5f83580c4d9a91a11d7e8dcf8ea25caf8f83d868d2f3dcffe07790939362816960327c7
6
+ metadata.gz: 899007fe8edd25ee186331a788caec03728b28a678d99739881d4999d07ccff36651b8f484fac00015b824e652298ec038a963725df067d39f4ab8307f8b05d1
7
+ data.tar.gz: 7a2e289db5b166bd967aa21a0c38e4c4d33a06507509b52b317d4a2e115720bb702104541a4a0cf21587d1dbb62425fb52cd5feab31b6f52e372596403d8182b
@@ -16,7 +16,7 @@ module Souls
16
16
  end
17
17
 
18
18
  def get_endpoint(worker_name: "")
19
- system("gcloud run services list | grep #{worker_name} | awk '{print $4}'")
19
+ `gcloud run services list | grep #{worker_name} | awk '{print $4}'`
20
20
  end
21
21
  end
22
22
  end
@@ -11,7 +11,7 @@ module Souls
11
11
  )
12
12
  end
13
13
 
14
- def pathch_instance(instance_name: "")
14
+ def patch_instance(instance_name: "")
15
15
  app_name = Souls.configuration.app
16
16
  instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
17
17
  project_id = Souls.configuration.project_id
@@ -7,38 +7,44 @@ module Souls
7
7
  end
8
8
 
9
9
  def update_conf(strain: "mother")
10
+ require("#{Souls.get_mother_path}/config/souls")
10
11
  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"
12
+ Dir.chdir(Souls.get_mother_path.to_s) do
13
+ file_path = strain == "mother" ? "config/souls.rb" : "apps/api/config/souls.rb"
14
+ new_file_path = "souls.rb"
15
+ worker_switch = false
16
+ File.open(new_file_path, "w") do |new_line|
17
+ File.open(file_path, "r") do |f|
18
+ f.each_line do |line|
19
+ worker_switch = true if line.include?("config.workers")
20
+ next if line.strip == "end"
19
21
 
20
- new_line.write(line) unless worker_switch
22
+ new_line.write(line) unless worker_switch
21
23
 
22
- next unless worker_switch
24
+ next unless worker_switch
23
25
 
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
26
+ new_line.write(" config.workers = [\n")
27
+ workers.each do |worker|
28
+ base_url = Souls::Gcloud::Run.get_endpoint(worker_name: worker[:name])
29
+ endpoint = Souls.configuration.endpoint
30
+ new_line.write(<<-TEXT)
31
+ {
32
+ name: "#{worker[:name]}",
33
+ endpoint: "#{base_url.strip}#{endpoint}",
34
+ port: #{worker[:port]}
35
+ },
36
+ TEXT
37
+ end
38
+ break
34
39
  end
35
- break
36
40
  end
41
+ new_line.write(<<~TEXT)
42
+ ]
43
+ end
44
+ TEXT
37
45
  end
38
- new_line.write(<<-TEXT)
39
- ]
40
- end
41
- TEXT
46
+ FileUtils.rm(file_path)
47
+ FileUtils.mv(new_file_path, file_path)
42
48
  end
43
49
  end
44
50
  end
@@ -49,7 +49,7 @@ module Souls
49
49
  require("#{Souls.get_mother_path}/config/souls")
50
50
  worker_name = topic_id.split("_")[0]
51
51
 
52
- subscription_id = "#{topic_id}-sub"
52
+ subscription_id = "#{topic_id}_sub"
53
53
  endpoint = ""
54
54
  worker_paths = Souls.configuration.workers
55
55
  worker_paths.each do |worker|
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.41.2".freeze
2
+ VERSION = "0.43.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.20.2
1
+ 0.22.0
@@ -1 +1 @@
1
- 0.20.2
1
+ 0.22.0
@@ -13,37 +13,35 @@ module Souls
13
13
  private
14
14
 
15
15
  def mailgun_mailer(class_name: "mailer")
16
- file_dir = "./app/graphql/mutations/mailers/"
16
+ file_dir = "./app/graphql/mutations/"
17
17
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
18
- file_path = "#{file_dir}#{class_name.singularize}_mailer.rb"
18
+ file_path = "#{file_dir}#{class_name.singularize}.rb"
19
19
  raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
20
20
 
21
21
  File.open(file_path, "w") do |f|
22
22
  f.write(<<~TEXT)
23
23
  module Mutations
24
- module Mailers
25
- class #{class_name.camelize}Mailer < BaseMutation
26
- description "Mail を送信します。"
27
- field :response, String, null: false
24
+ class #{class_name.camelize} < BaseMutation
25
+ description "Mail を送信します。"
26
+ field :response, String, null: false
28
27
 
29
- def resolve
30
- # First, instantiate the Mailgun Client with your API key
31
- mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
28
+ def resolve
29
+ # First, instantiate the Mailgun Client with your API key
30
+ mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
32
31
 
33
- # Define your message parameters
34
- message_params = {
35
- from: "postmaster@YOUR-DOMAIN",
36
- to: "sending@to.mail.com",
37
- subject: "SOULs Mailer test!",
38
- text: "It is really easy to send a message!"
39
- }
32
+ # Define your message parameters
33
+ message_params = {
34
+ from: "postmaster@YOUR-DOMAIN",
35
+ to: "sending@to.mail.com",
36
+ subject: "SOULs Mailer test!",
37
+ text: "It is really easy to send a message!"
38
+ }
40
39
 
41
- # Send your message through the client
42
- mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
43
- { response: "Job done!" }
44
- rescue StandardError => e
45
- GraphQL::ExecutionError.new(e.to_s)
46
- end
40
+ # Send your message through the client
41
+ mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
42
+ { response: "Job done!" }
43
+ rescue StandardError => e
44
+ GraphQL::ExecutionError.new(e.to_s)
47
45
  end
48
46
  end
49
47
  TEXT
@@ -5,13 +5,13 @@ module Souls
5
5
  def mutation(class_name: "csv_export")
6
6
  file_dir = "./app/graphql/mutations/"
7
7
  FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
8
- file_path = "#{file_dir}#{class_name.singularize}_job.rb"
8
+ file_path = "#{file_dir}#{class_name.singularize}.rb"
9
9
  raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
10
10
 
11
11
  File.open(file_path, "w") do |f|
12
12
  f.write(<<~TEXT)
13
13
  module Mutations
14
- class #{class_name.camelize}Job < BaseMutation
14
+ class #{class_name.camelize} < BaseMutation
15
15
  description "Job Description"
16
16
  field :response, String, null: false
17
17
 
data/lib/souls.rb CHANGED
@@ -247,14 +247,13 @@ module Souls
247
247
  end
248
248
 
249
249
  class Configuration
250
- attr_accessor :app, :strain, :project_id, :github_repo, :worker_endpoint, :fixed_gems, :workers
250
+ attr_accessor :app, :strain, :project_id, :endpoint, :fixed_gems, :workers
251
251
 
252
252
  def initialize
253
253
  @app = nil
254
254
  @project_id = nil
255
+ @endpoint = nil
255
256
  @strain = nil
256
- @github_repo = nil
257
- @worker_endpoint = nil
258
257
  @fixed_gems = nil
259
258
  @workers = nil
260
259
  end
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.41.2
4
+ version: 0.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI