souls 1.7.29 → 1.7.33

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: 543a49c66529eb4d7a25953cc87352c79ac8e5687b19102e9ce5101cee31f426
4
- data.tar.gz: 45047547362ee7b524ebfc7a60956e7685385ebdb5d675bfd6ef9a56d8cc03da
3
+ metadata.gz: c07931ef30cc914dbc6e03e9b6eaf87411f927ff17917faf20c9d865308f808b
4
+ data.tar.gz: ae6d456bc5df67d66b23393e6dbfd13492220d09266581a459bc323845e50884
5
5
  SHA512:
6
- metadata.gz: 6997c1ec1dd34d4a79f4ceccbdde5936646222fdf9374eeaf66eefcf3cf6b13bcb14ddb697bbb111c8ad9cdadbec9044f81757f7589cf95d9839b9af1a4b18fe
7
- data.tar.gz: d634d87fb05dbb05defe161ad25c31fb82e56a9c3eae292cf6457fe9a29e33afb6d25a240d2dc7b0694e600764ea4368501c766c5133929496ac52e9a4ac410d
6
+ metadata.gz: c428b926587c8f911d055dfdc5d6a928fdcd3e9a3b1f007d9540198eb2ada384463e81d6fb4f550266bb91677c3606f00a81ea449f156e588fe3742888bc8552
7
+ data.tar.gz: 05c5652223e43977a053dee4edc9d0c5dc2bce8e209286ec171c6992d443018ac42b44d0ca2ccef3c54532015aef95f8d9f979208ad14a2c6320ae43ff75a6f3
@@ -24,6 +24,7 @@ module Souls
24
24
  file_path = ".env"
25
25
  File.open(file_path, "w") do |line|
26
26
  line.write(<<~TEXT)
27
+ GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS=1
27
28
  SOULS_DB_HOST=#{instance_ip}
28
29
  SOULS_DB_PW=#{password}
29
30
  SOULS_DB_USER=postgres
@@ -77,7 +77,7 @@ module Souls
77
77
 
78
78
  def resolve
79
79
  # First, instantiate the Mailgun Client with your API key
80
- mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
80
+ mg_client = ::Mailgun::Client.new(ENV['MAILGUN_KEY'])
81
81
 
82
82
  # Define your message parameters
83
83
  message_params = {
@@ -88,7 +88,7 @@ module Souls
88
88
  }
89
89
 
90
90
  # Send your message through the client
91
- mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
91
+ mg_client.send_message(ENV['MAILGUN_DOMAIN'], message_params)
92
92
  { response: "Job done!" }
93
93
  rescue StandardError => e
94
94
  GraphQL::ExecutionError.new(e.to_s)
@@ -2,23 +2,27 @@ module Souls
2
2
  class Github < Thor
3
3
  desc "secret_set", "Github Secret Set from .env.production"
4
4
  def secret_set
5
- file_path = ".env.production"
6
- File.open(file_path, "r") do |file|
7
- file.each_line do |line|
8
- key_and_value = line.split("=")
9
- system("gh secret set #{key_and_value[0]} -b \"#{key_and_value[1].strip}\"")
5
+ Dir.chdir(Souls.get_mother_path.to_s) do
6
+ file_path = ".env.production"
7
+ File.open(file_path, "r") do |file|
8
+ file.each_line do |line|
9
+ key_and_value = line.split("=")
10
+ system("gh secret set #{key_and_value[0]} -b \"#{key_and_value[1].strip}\"")
11
+ end
10
12
  end
11
13
  end
12
14
  end
13
15
 
14
16
  desc "add_env", "Add New env and Sync Github Secret"
15
- method_option :key, aliases: "--key", required: true, desc: "Key Name"
16
- method_option :value, aliases: "--value", required: true, desc: "Value Name"
17
17
  method_option :dqm, type: :boolean, aliases: "--dqm", default: false, desc: "Enable Double Quotation Mark"
18
18
  def add_env
19
- update_env_production(key: options[:key], value: options[:value], dqm: options[:dqm])
20
- update_api_env(key: options[:key], value: options[:value], dqm: options[:dqm])
21
- update_github_actions(key: options[:key])
19
+ prompt = TTY::Prompt.new
20
+ key = prompt.ask("Set Key:")
21
+ value = prompt.ask("Set Value:")
22
+ update_env_production(key: key, value: value, dqm: options[:dqm])
23
+ update_api_env(key: key, value: value, dqm: options[:dqm])
24
+ update_workers_env(key: key, value: value, dqm: options[:dqm])
25
+ update_github_actions(key: key)
22
26
  Souls::Github.new.invoke(:secret_set)
23
27
  end
24
28
 
@@ -52,13 +56,28 @@ module Souls
52
56
  end
53
57
  end
54
58
 
59
+ def update_workers_env(key:, value:, dqm: false)
60
+ Dir.chdir(Souls.get_mother_path.to_s) do
61
+ workers = Dir["apps/*"]
62
+ workers.delete("apps/api")
63
+ workers.each do |worker_path|
64
+ file_path = "#{worker_path}/.env"
65
+ File.open(file_path, "a") do |line|
66
+ dqm ? line.write("\n#{key.upcase}=\"#{value}\"") : line.write("\n#{key.upcase}=#{value}")
67
+ end
68
+ puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
69
+ end
70
+ end
71
+ end
72
+
55
73
  def update_github_actions(key:)
56
74
  Dir.chdir(Souls.get_mother_path.to_s) do
57
75
  file_paths = Dir[".github/workflows/*.yml"]
58
76
  file_paths.each do |file_path|
59
- File.open(file_path, "a") do |line|
60
- line.write(" \\ \n --set-env-vars=\"#{key.upcase}=${{ secrets.#{key.upcase} }}\"")
61
- end
77
+ worker_workflow = File.readlines(file_path)
78
+ worker_workflow[worker_workflow.size - 1] = worker_workflow.last.chomp
79
+ worker_workflow << " \\ \n --set-env-vars=\"#{key.upcase}=${{ secrets.#{key.upcase} }}\""
80
+ File.open(file_path, "w") { |f| f.write(worker_workflow.join) }
62
81
  puts(Paint % ["Updated file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
63
82
  end
64
83
  end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.7.29".freeze
2
+ VERSION = "1.7.33".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.7.29
1
+ 1.7.33
@@ -1 +1 @@
1
- 1.7.29
1
+ 1.7.33
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.7.29
4
+ version: 1.7.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI