souls 0.31.0 → 0.32.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: 378a3ef40cd5cbc43e093f65d122236ea79c69a26fb823a7666296f87b36221e
4
- data.tar.gz: 4396ee4d17f3c1dfeeaf68ba394cfa8252da1269cb8423438242387f4399dd93
3
+ metadata.gz: 68f41cff617dc31b7d1fa9b8765fd3700f8a7873f6f609e4186ed29fd67772ce
4
+ data.tar.gz: deac03ec2ebfee4ef9215e4bebdf0548f23021190b8d2347d378f9cc0272deec
5
5
  SHA512:
6
- metadata.gz: 2686058accaf16fd46e5e54acd294f33296340812417af70c8c2a5730f05082e1bfa6837b60521b4f322b8352f7121094585007b360006ec997a5189958c3046
7
- data.tar.gz: e9730f1a4824de288bdb98385cfbb43e05ecd0353a9a49fd6079f5130bb958a238960ee73518e2dc0eaf424e9457ea111e945fa80567314fc93292fc20f8cfda
6
+ metadata.gz: 364fb27cfd50812f11019bcb9f2e6582e0faa5c41a4540046faa8c912176bca7b404a941e3956ef88470cca92f13b118649fb4ca3c02be63717a12f710d00a21
7
+ data.tar.gz: 3d8be9698b076e795000a8c114ff2007d63c601e9388d44be933478a5facd4f013d2accccbad57e47cb6f662fd9d9c87e6b08150bdb74fe0326f50a5db0b9a3f
data/exe/souls CHANGED
@@ -2,7 +2,7 @@
2
2
  require "souls"
3
3
  begin
4
4
  souls_command = ARGV[0]
5
- require("./config/souls") unless ["new", "i", "-v", "deploy"].include?(souls_command)
5
+ require("./config/souls") unless ["new", "docker", "-v", "deploy"].include?(souls_command)
6
6
  rescue StandardError
7
7
  puts("Make sure you are at SOULs APP directory!")
8
8
  end
@@ -80,11 +80,34 @@ begin
80
80
  send_method = ARGV[1]
81
81
  Souls::Docker.public_send(send_method)
82
82
  when "gcloud"
83
- args = ARGV
83
+ command = ARGV[1]
84
84
  status = Paint["Running Gcloud Commands...", :yellow]
85
85
  Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
86
86
  Whirly.status = status
87
- Souls::Gcloud.return_method(args)
87
+ case command
88
+ when "get_iam_key"
89
+ app_name = Souls.configuration.app
90
+ project_id = Souls.configuration.project_id
91
+ Souls::Gcloud::Iam.create_service_account(service_account: app_name)
92
+ Souls::Gcloud::Iam.create_service_account_key(service_account: app_name, project_id: project_id)
93
+ Souls::Gcloud.enable_permissions
94
+ Souls::Gcloud::Iam.add_permissions(service_account: app_name, project_id: project_id)
95
+ Souls::Gcloud::Iam.export_key_to_console
96
+ when "auth_login"
97
+ project_id = Souls.configuration.project_id
98
+ Souls::Gcloud.auth_login(project_id: project_id)
99
+ else
100
+ module_name = ARGV[1]
101
+ method_name = ARGV[2]
102
+ ARGV.shift(3)
103
+ key_strings = []
104
+ keys = []
105
+ ARGV.each { |n| n.include?(":") ? keys << n.gsub(":", "").to_sym : key_strings << n }
106
+ raise(StandardError, "wrong arguments!") unless keys.size == key_strings.size
107
+
108
+ args = keys.zip(key_strings).to_h
109
+ Object.const_get("Souls::Gcloud::#{module_name.camelize}").public_send(method_name.to_sym, **args)
110
+ end
88
111
  Whirly.status = "Done!"
89
112
  end
90
113
  when "-v", "--version", "v", "version", "-version", "--v"
@@ -96,7 +119,7 @@ begin
96
119
  status = Paint["Checking for updates...", :yellow]
97
120
  Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
98
121
  Whirly.status = status
99
- Souls.update_gemfile
122
+ Souls::Upgrade.update_gemfile
100
123
  Whirly.status = "Done!"
101
124
  end
102
125
  else
data/lib/souls.rb CHANGED
@@ -32,108 +32,6 @@ module Souls
32
32
  class << self
33
33
  attr_accessor :configuration
34
34
 
35
- def gemfile_latest_version
36
- file_path = "./Gemfile"
37
- updated_gems = []
38
- updated_gem_versions = []
39
- updated_lines = []
40
- from_dev = false
41
- File.open(file_path, "r") do |f|
42
- f.each_line do |line|
43
- from_dev = true if line.include?("group")
44
- next unless line.include?("gem ")
45
-
46
- gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
47
- url = URI("https://rubygems.org/api/v1/versions/#{gem[0]}/latest.json")
48
- res = Net::HTTP.get_response(url)
49
- data = JSON.parse(res.body)
50
- next if Souls.configuration.fixed_gems.include?(gem[0].to_s)
51
- next if data["version"].to_s == gem[1].to_s
52
-
53
- updated_lines << if from_dev
54
- " gem \"#{gem[0]}\", \"#{data['version']}\""
55
- else
56
- "gem \"#{gem[0]}\", \"#{data['version']}\""
57
- end
58
- updated_gems << (gem[0]).to_s
59
- updated_gem_versions << data["version"]
60
- system("gem update #{gem[0]}")
61
- end
62
- end
63
- {
64
- gems: updated_gems,
65
- lines: updated_lines,
66
- updated_gem_versions: updated_gem_versions
67
- }
68
- end
69
-
70
- def update_gemfile
71
- file_path = "./Gemfile"
72
- tmp_file = "./tmp/Gemfile"
73
- new_gems = gemfile_latest_version
74
- logs = []
75
- message = Paint["\nAlready Up to date!", :green]
76
- return "Already Up to date!" && puts(message) if new_gems[:gems].blank?
77
-
78
- @i = 0
79
- File.open(file_path, "r") do |f|
80
- File.open(tmp_file, "w") do |new_line|
81
- f.each_line do |line|
82
- gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
83
- if new_gems[:gems].include?(gem[0])
84
- old_ver = gem[1].split(".")
85
- new_ver = new_gems[:updated_gem_versions][@i].split(".")
86
- if old_ver[0] < new_ver[0]
87
- logs << Paint % [
88
- "#{gem[0]} v#{gem[1]} → %{red_text}",
89
- :white,
90
- {
91
- red_text: ["v#{new_gems[:updated_gem_versions][@i]}", :red]
92
- }
93
- ]
94
- elsif old_ver[1] < new_ver[1]
95
- logs << Paint % [
96
- "#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.%{yellow_text}",
97
- :white,
98
- {
99
- yellow_text: ["#{new_ver[1]}.#{new_ver[2]}", :yellow]
100
- }
101
- ]
102
- elsif old_ver[2] < new_ver[2]
103
- logs << Paint % [
104
- "#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.#{new_ver[1]}.%{green_text}",
105
- :white,
106
- {
107
- green_text: [(new_ver[2]).to_s, :green]
108
- }
109
- ]
110
- end
111
- if gem[0] == "souls"
112
- logs << Paint % [
113
- "\nSOULs Doc: %{cyan_text}",
114
- :white,
115
- { cyan_text: ["https://souls.elsoul.nl\n", :cyan] }
116
- ]
117
- end
118
- new_line.write("#{new_gems[:lines][@i]}\n")
119
- @i += 1
120
- else
121
- new_line.write(line)
122
- end
123
- end
124
- end
125
- end
126
- FileUtils.rm("./Gemfile")
127
- FileUtils.rm("./Gemfile.lock")
128
- FileUtils.mv("./tmp/Gemfile", "./Gemfile")
129
- system("bundle update")
130
- success = Paint["\n\nSuccessfully Updated These Gems!\n", :green]
131
- puts(success)
132
- logs.each do |line|
133
- puts(line)
134
- end
135
- end
136
-
137
35
  def update_repo(service_name: "api", update_kind: "patch")
138
36
  current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
139
37
  current_ver = get_latest_version_txt(service_name: service_name)
@@ -249,24 +147,6 @@ module Souls
249
147
  puts(Paint["\nSuccessfully Updated #{service_name} Gemfile!", :green])
250
148
  end
251
149
 
252
- def file_diff(paths = [])
253
- paths.map do |path|
254
- stat(path)[:last_update]
255
- end
256
- end
257
-
258
- def stat(path)
259
- s = File::Stat.new(path)
260
- last_update = s.mtime.to_s
261
- last_status_change = s.ctime.to_s
262
- last_access = s.atime.to_s
263
- {
264
- last_update: last_update,
265
- last_status_change: last_status_change,
266
- last_access: last_access
267
- }
268
- end
269
-
270
150
  def check_schema(class_name: "user")
271
151
  schema_data = get_columns_num(class_name: class_name)
272
152
  create_migration_data = get_create_migration_type(class_name: class_name)
data/lib/souls/cli.rb CHANGED
@@ -2,6 +2,7 @@ require_relative "./cli/docker"
2
2
  require_relative "./cli/gcloud"
3
3
  require_relative "./cli/release"
4
4
  require_relative "./cli/sync"
5
+ require_relative "./cli/upgrade"
5
6
 
6
7
  module Souls
7
8
  end
@@ -1,8 +1,8 @@
1
- require_relative "./gcloud/compute"
2
1
  require_relative "./gcloud/iam"
3
2
  require_relative "./gcloud/pubsub"
4
- require_relative "./gcloud/methods"
5
3
  require_relative "./gcloud/run"
4
+ require_relative "./gcloud/sql"
5
+ require_relative "./gcloud/gcloud"
6
6
 
7
7
  module Souls
8
8
  module Gcloud
@@ -24,14 +24,6 @@ module Souls
24
24
  system("gcloud services enable run.googleapis.com")
25
25
  puts("Operating permission to run.googleapis.com")
26
26
  end
27
-
28
- def create_sql_instance(instance_name: "souls-db", root_pass: "Postgre123!", zone: "asia-northeast1-b")
29
- system(
30
- "gcloud sql instances create #{instance_name}
31
- --database-version=POSTGRES_13 --cpu=2 --memory=7680MB --zone=#{zone}
32
- --root-password='#{root_pass}' --database-flags cloudsql.iam_authentication=on"
33
- )
34
- end
35
27
  end
36
28
  end
37
29
  end
@@ -1,78 +1,8 @@
1
+ require_relative "./iam/iam"
2
+
1
3
  module Souls
2
4
  module Gcloud
3
- class << self
4
- def create_service_account(service_account: "souls-app")
5
- system(
6
- "gcloud iam service-accounts create #{service_account} \
7
- --description='Souls Service Account' \
8
- --display-name=#{service_account}"
9
- )
10
- end
11
-
12
- def create_service_account_key(service_account: "souls-app", project_id: "souls-app")
13
- system(
14
- "gcloud iam service-accounts keys create ./config/keyfile.json \
15
- --iam-account #{service_account}@#{project_id}.iam.gserviceaccount.com"
16
- )
17
- end
18
-
19
- def export_key_to_console
20
- github_repo = Souls.configuration.github_repo || "elsoul/souls"
21
- file_path = "config/keyfile.json"
22
- puts(Paint["======= below(ここから)=======", :cyan])
23
- text = []
24
- File.open(file_path, "r") do |line|
25
- line.each_line do |l|
26
- text << l
27
- end
28
- end
29
- key = text.join(",").gsub(/^,/, "").chomp!
30
- puts(Paint[key, :white])
31
- puts(Paint["======= above(ここまで)=======", :cyan])
32
- github_secret_url = "https://github.com/#{github_repo}/settings/secrets/actions"
33
- souls_doc_url = "https://souls.elsoul.nl/docs/chapter2/#43-github-シークレットキーの登録"
34
- txt1 = <<~TEXT
35
-
36
- ⬆⬆⬆ Copy the service account key above ⬆⬆⬆⬆
37
-
38
- And
39
-
40
- Go to %{yellow_text}
41
-
42
- Reference: %{yellow_text2}
43
- TEXT
44
- puts(
45
- Paint % [
46
- txt1,
47
- :white,
48
- { yellow_text: [github_secret_url, :yellow], yellow_text2: [souls_doc_url, :yellow] }
49
- ]
50
- )
51
- FileUtils.rm(file_path)
52
- end
53
-
54
- def add_service_account_role(service_account: "souls-app", project_id: "souls-app", role: "roles/firebase.admin")
55
- system(
56
- "gcloud projects add-iam-policy-binding #{project_id} \
57
- --member='serviceAccount:#{service_account}@#{project_id}.iam.gserviceaccount.com' \
58
- --role=#{role}"
59
- )
60
- end
61
-
62
- def add_permissions(service_account: "souls-app", project_id: "souls-app")
63
- roles = [
64
- "roles/cloudsql.instanceUser",
65
- "roles/containerregistry.ServiceAgent",
66
- "roles/pubsub.serviceAdmin",
67
- "roles/firestore.serviceAdmin",
68
- "roles/iam.serviceAccountUser",
69
- "roles/storage.objectAdmin",
70
- "roles/run.admin"
71
- ]
72
- roles.each do |role|
73
- add_service_account_role(service_account: service_account, project_id: project_id, role: role)
74
- end
75
- end
5
+ module Iam
76
6
  end
77
7
  end
78
8
  end
@@ -0,0 +1,80 @@
1
+ module Souls
2
+ module Gcloud
3
+ module Iam
4
+ class << self
5
+ def create_service_account(service_account: "souls-app")
6
+ system(
7
+ "gcloud iam service-accounts create #{service_account} \
8
+ --description='Souls Service Account' \
9
+ --display-name=#{service_account}"
10
+ )
11
+ end
12
+
13
+ def create_service_account_key(service_account: "souls-app", project_id: "souls-app")
14
+ system(
15
+ "gcloud iam service-accounts keys create ./config/keyfile.json \
16
+ --iam-account #{service_account}@#{project_id}.iam.gserviceaccount.com"
17
+ )
18
+ end
19
+
20
+ def export_key_to_console
21
+ github_repo = Souls.configuration.github_repo || "elsoul/souls"
22
+ file_path = "config/keyfile.json"
23
+ puts(Paint["======= below(ここから)=======", :cyan])
24
+ text = []
25
+ File.open(file_path, "r") do |line|
26
+ line.each_line do |l|
27
+ text << l
28
+ end
29
+ end
30
+ key = text.join(",").gsub(/^,/, "").chomp!
31
+ puts(Paint[key, :white])
32
+ puts(Paint["======= above(ここまで)=======", :cyan])
33
+ github_secret_url = "https://github.com/#{github_repo}/settings/secrets/actions"
34
+ souls_doc_url = "https://souls.elsoul.nl/docs/tutorial/zero-to-deploy/#43-github-シークレットキーの登録"
35
+ txt1 = <<~TEXT
36
+
37
+ ⬆⬆⬆ Copy the service account key above ⬆⬆⬆⬆
38
+
39
+ And
40
+
41
+ Go to %{yellow_text}
42
+
43
+ Reference: %{yellow_text2}
44
+ TEXT
45
+ puts(
46
+ Paint % [
47
+ txt1,
48
+ :white,
49
+ { yellow_text: [github_secret_url, :yellow], yellow_text2: [souls_doc_url, :yellow] }
50
+ ]
51
+ )
52
+ FileUtils.rm(file_path)
53
+ end
54
+
55
+ def add_service_account_role(service_account: "souls-app", project_id: "souls-app", role: "roles/firebase.admin")
56
+ system(
57
+ "gcloud projects add-iam-policy-binding #{project_id} \
58
+ --member='serviceAccount:#{service_account}@#{project_id}.iam.gserviceaccount.com' \
59
+ --role=#{role}"
60
+ )
61
+ end
62
+
63
+ def add_permissions(service_account: "souls-app", project_id: "souls-app")
64
+ roles = [
65
+ "roles/cloudsql.admin",
66
+ "roles/containerregistry.ServiceAgent",
67
+ "roles/pubsub.editor",
68
+ "roles/firestore.editor",
69
+ "roles/iam.serviceAccountUser",
70
+ "roles/storage.objectAdmin",
71
+ "roles/run.editor"
72
+ ]
73
+ roles.each do |role|
74
+ add_service_account_role(service_account: service_account, project_id: project_id, role: role)
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -1,33 +1,9 @@
1
+ require_relative "./pubsub/topics"
2
+ require_relative "./pubsub/subscriptions"
3
+
1
4
  module Souls
2
5
  module Gcloud
3
- class << self
4
- def create_pubsub_topic(topic_name: "send-user-mail")
5
- system("gcloud pubsub topics create #{topic_name}")
6
- end
7
-
8
- def create_pubsub_subscription(
9
- topic_name: "send-user-mail",
10
- project_id: "souls-app",
11
- service_account: "souls-app",
12
- endpoint: "https:://test.com"
13
- )
14
- system(
15
- "gcloud pubsub subscriptions create #{topic_name}-sub \
16
- --topic #{topic_name} \
17
- --topic-project #{project_id} \
18
- --push-auth-service-account #{service_account} \
19
- --push-endpoint #{endpoint} \
20
- --expiration-period never
21
- "
22
- )
23
- end
24
-
25
- def update_pubsub_subscription(
26
- topic_name: "send-user-mail",
27
- endpoint: "https:://test.com"
28
- )
29
- system("gcloud pubsub subscriptions update #{topic_name}-sub --push-endpoint #{endpoint} ")
30
- end
6
+ module Pubsub
31
7
  end
32
8
  end
33
9
  end
@@ -0,0 +1,31 @@
1
+ module Souls
2
+ module Gcloud
3
+ module Pubsub
4
+ class << self
5
+ def create_subscription(
6
+ topic_name: "send-user-mail",
7
+ project_id: "souls-app",
8
+ service_account: "souls-app",
9
+ endpoint: "https:://test.com"
10
+ )
11
+ system(
12
+ "gcloud pubsub subscriptions create #{topic_name}-sub \
13
+ --topic #{topic_name} \
14
+ --topic-project #{project_id} \
15
+ --push-auth-service-account #{service_account} \
16
+ --push-endpoint #{endpoint} \
17
+ --expiration-period never
18
+ "
19
+ )
20
+ end
21
+
22
+ def update_subscription(
23
+ topic_name: "send-user-mail",
24
+ endpoint: "https:://test.com"
25
+ )
26
+ system("gcloud pubsub subscriptions update #{topic_name}-sub --push-endpoint #{endpoint} ")
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,11 @@
1
+ module Souls
2
+ module Gcloud
3
+ module Pubsub
4
+ class << self
5
+ def create_topic(topic_name: "send-user-mail")
6
+ system("gcloud pubsub topics create #{topic_name}")
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,16 +1,9 @@
1
+ require_relative "./run/run"
2
+
1
3
  module Souls
2
4
  module Gcloud
3
- class << self
4
- def run_awake(app_name: "souls-app", url: "")
5
- system(
6
- "gcloud scheduler jobs create http #{app_name}-awake
7
- --schedule '0,10,20,30,40,50 * * * *' --uri #{url} --http-method GET"
8
- )
9
- end
10
-
11
- def run_list(project_id: "souls-app")
12
- system("gcloud run services list --project #{project_id}")
13
- end
5
+ module Run
14
6
  end
15
7
  end
16
8
  end
9
+
@@ -0,0 +1,18 @@
1
+ module Souls
2
+ module Gcloud
3
+ module Run
4
+ class << self
5
+ def awake(app_name: "souls-app", url: "")
6
+ system(
7
+ "gcloud scheduler jobs create http #{app_name}-awake
8
+ --schedule '0,10,20,30,40,50 * * * *' --uri #{url} --http-method GET"
9
+ )
10
+ end
11
+
12
+ def list(project_id: "souls-app")
13
+ system("gcloud run services list --project #{project_id}")
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ require_relative "./sql/sql"
2
+
3
+ module Souls
4
+ module Gcloud
5
+ module Sql
6
+ end
7
+ end
8
+ end
9
+
@@ -0,0 +1,15 @@
1
+ module Souls
2
+ module Gcloud
3
+ module Sql
4
+ class << self
5
+ def create_instance(instance_name: "souls-db", root_pass: "Postgre123!", zone: "asia-northeast1-b")
6
+ system(
7
+ "gcloud sql instances create #{instance_name}
8
+ --database-version=POSTGRES_13 --cpu=2 --memory=7680MB --zone=#{zone}
9
+ --root-password='#{root_pass}' --database-flags cloudsql.iam_authentication=on"
10
+ )
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -16,6 +16,24 @@ module Souls
16
16
 
17
17
  private
18
18
 
19
+ def file_diff(paths = [])
20
+ paths.map do |path|
21
+ stat(path)[:last_update]
22
+ end
23
+ end
24
+
25
+ def stat(path)
26
+ s = File::Stat.new(path)
27
+ last_update = s.mtime.to_s
28
+ last_status_change = s.ctime.to_s
29
+ last_access = s.atime.to_s
30
+ {
31
+ last_update: last_update,
32
+ last_status_change: last_status_change,
33
+ last_access: last_access
34
+ }
35
+ end
36
+
19
37
  def cp_and_dl_files(api_dir: "", worker_dir: "")
20
38
  if Dir["#{worker_dir}/*.rb"].blank?
21
39
 
@@ -0,0 +1,5 @@
1
+ require_relative "./upgrade/gem_update"
2
+ module Souls
3
+ module Upgrade
4
+ end
5
+ end
@@ -0,0 +1,107 @@
1
+ module Souls
2
+ module Upgrade
3
+ class << self
4
+ def gemfile_latest_version
5
+ file_path = "./Gemfile"
6
+ updated_gems = []
7
+ updated_gem_versions = []
8
+ updated_lines = []
9
+ from_dev = false
10
+ File.open(file_path, "r") do |f|
11
+ f.each_line do |line|
12
+ from_dev = true if line.include?("group")
13
+ next unless line.include?("gem ")
14
+
15
+ gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
16
+ url = URI("https://rubygems.org/api/v1/versions/#{gem[0]}/latest.json")
17
+ res = Net::HTTP.get_response(url)
18
+ data = JSON.parse(res.body)
19
+ next if Souls.configuration.fixed_gems.include?(gem[0].to_s)
20
+ next if data["version"].to_s == gem[1].to_s
21
+
22
+ updated_lines << if from_dev
23
+ " gem \"#{gem[0]}\", \"#{data['version']}\""
24
+ else
25
+ "gem \"#{gem[0]}\", \"#{data['version']}\""
26
+ end
27
+ updated_gems << (gem[0]).to_s
28
+ updated_gem_versions << data["version"]
29
+ system("gem update #{gem[0]}")
30
+ end
31
+ end
32
+ {
33
+ gems: updated_gems,
34
+ lines: updated_lines,
35
+ updated_gem_versions: updated_gem_versions
36
+ }
37
+ end
38
+
39
+ def update_gemfile
40
+ file_path = "./Gemfile"
41
+ tmp_file = "./tmp/Gemfile"
42
+ new_gems = gemfile_latest_version
43
+ logs = []
44
+ message = Paint["\nAlready Up to date!", :green]
45
+ return "Already Up to date!" && puts(message) if new_gems[:gems].blank?
46
+
47
+ @i = 0
48
+ File.open(file_path, "r") do |f|
49
+ File.open(tmp_file, "w") do |new_line|
50
+ f.each_line do |line|
51
+ gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
52
+ if new_gems[:gems].include?(gem[0])
53
+ old_ver = gem[1].split(".")
54
+ new_ver = new_gems[:updated_gem_versions][@i].split(".")
55
+ if old_ver[0] < new_ver[0]
56
+ logs << Paint % [
57
+ "#{gem[0]} v#{gem[1]} → %{red_text}",
58
+ :white,
59
+ {
60
+ red_text: ["v#{new_gems[:updated_gem_versions][@i]}", :red]
61
+ }
62
+ ]
63
+ elsif old_ver[1] < new_ver[1]
64
+ logs << Paint % [
65
+ "#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.%{yellow_text}",
66
+ :white,
67
+ {
68
+ yellow_text: ["#{new_ver[1]}.#{new_ver[2]}", :yellow]
69
+ }
70
+ ]
71
+ elsif old_ver[2] < new_ver[2]
72
+ logs << Paint % [
73
+ "#{gem[0]} v#{gem[1]} → v#{new_ver[0]}.#{new_ver[1]}.%{green_text}",
74
+ :white,
75
+ {
76
+ green_text: [(new_ver[2]).to_s, :green]
77
+ }
78
+ ]
79
+ end
80
+ if gem[0] == "souls"
81
+ logs << Paint % [
82
+ "\nSOULs Doc: %{cyan_text}",
83
+ :white,
84
+ { cyan_text: ["https://souls.elsoul.nl\n", :cyan] }
85
+ ]
86
+ end
87
+ new_line.write("#{new_gems[:lines][@i]}\n")
88
+ @i += 1
89
+ else
90
+ new_line.write(line)
91
+ end
92
+ end
93
+ end
94
+ end
95
+ FileUtils.rm("./Gemfile")
96
+ FileUtils.rm("./Gemfile.lock")
97
+ FileUtils.mv("./tmp/Gemfile", "./Gemfile")
98
+ system("bundle update")
99
+ success = Paint["\n\nSuccessfully Updated These Gems!\n", :green]
100
+ puts(success)
101
+ logs.each do |line|
102
+ puts(line)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.31.0".freeze
2
+ VERSION = "0.32.2".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.10.0
1
+ 0.11.2
@@ -1 +1 @@
1
- 0.10.0
1
+ 0.11.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.31.0
4
+ version: 0.32.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-08-18 00:00:00.000000000 Z
13
+ date: 2021-08-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -129,15 +129,22 @@ files:
129
129
  - lib/souls/cli/docker.rb
130
130
  - lib/souls/cli/docker/docker.rb
131
131
  - lib/souls/cli/gcloud.rb
132
- - lib/souls/cli/gcloud/compute.rb
132
+ - lib/souls/cli/gcloud/gcloud.rb
133
133
  - lib/souls/cli/gcloud/iam.rb
134
- - lib/souls/cli/gcloud/methods.rb
134
+ - lib/souls/cli/gcloud/iam/iam.rb
135
135
  - lib/souls/cli/gcloud/pubsub.rb
136
+ - lib/souls/cli/gcloud/pubsub/subscriptions.rb
137
+ - lib/souls/cli/gcloud/pubsub/topics.rb
136
138
  - lib/souls/cli/gcloud/run.rb
139
+ - lib/souls/cli/gcloud/run/run.rb
140
+ - lib/souls/cli/gcloud/sql.rb
141
+ - lib/souls/cli/gcloud/sql/sql.rb
137
142
  - lib/souls/cli/release.rb
138
143
  - lib/souls/cli/release/release.rb
139
144
  - lib/souls/cli/sync.rb
140
145
  - lib/souls/cli/sync/model.rb
146
+ - lib/souls/cli/upgrade.rb
147
+ - lib/souls/cli/upgrade/gem_update.rb
141
148
  - lib/souls/init.rb
142
149
  - lib/souls/version.rb
143
150
  - lib/souls/versions/.souls_api_version
@@ -1,69 +0,0 @@
1
- module Souls
2
- module Gcloud
3
- class << self
4
- def return_method(args)
5
- method = args[1]
6
- case method
7
- when "get_iam_key"
8
- app_name = Souls.configuration.app
9
- project_id = Souls.configuration.project_id
10
- Souls::Gcloud.create_service_account(service_account: app_name)
11
- Souls::Gcloud.create_service_account_key(service_account: app_name, project_id: project_id)
12
- Souls::Gcloud.export_key_to_console
13
- Souls::Gcloud.enable_permissions
14
- when "auth_login"
15
- project_id = Souls.configuration.project_id
16
- Souls::Gcloud.auth_login(project_id: project_id)
17
- when "enable_permissions"
18
- service_account = Souls.configuration.app
19
- project_id = Souls.configuration.project_id
20
- Souls::Gcloud.enable_permissions
21
- Souls::Gcloud.add_permissions(service_account: service_account, project_id: project_id)
22
- when "create_pubsub_topic"
23
- topic_name = args[2] || "send-user-mail"
24
- Souls::Gcloud.create_pubsub_topic(topic_name: topic_name)
25
- when "create_pubsub_subscription"
26
- project_id = Souls.configuration.project_id
27
- topic_name = args[2] || "send-user-mail"
28
- service_account = "#{Souls.configuration.app}@#{project_id}.iam.gserviceaccount.com"
29
- endpoint = Souls.configuration.worker_endpoint
30
- Souls::Gcloud.create_pubsub_subscription(
31
- topic_name: topic_name,
32
- project_id: project_id,
33
- service_account: service_account,
34
- endpoint: endpoint
35
- )
36
- when "create_sql_instance"
37
- instance_name = "#{Souls.configuration.app}-db"
38
- root_pass = args[2] || "password"
39
- zone = args[3] || "asia-northeast1-b"
40
- Souls::Gcloud.create_sql_instance(instance_name: instance_name, root_pass: root_pass, zone: zone)
41
- when "create_service_account"
42
- service_account = Souls.configuration.app
43
- Souls::Gcloud.create_service_account(service_account: service_account)
44
- when "create_service_account_key"
45
- service_account = Souls.configuration.app
46
- project_id = Souls.configuration.project_id
47
- Souls::Gcloud.create_service_account_key(service_account: service_account, project_id: project_id)
48
- when "add_service_account_role"
49
- service_account = Souls.configuration.app
50
- project_id = Souls.configuration.project_id
51
- role = args[2] || "roles/firebase.admin"
52
- Souls::Gcloud.add_service_account_role(service_account: service_account, project_id: project_id, role: role)
53
- when "add_permissions"
54
- service_account = Souls.configuration.app
55
- project_id = Souls.configuration.project_id
56
- Souls::Gcloud.add_permissions(service_account: service_account, project_id: project_id)
57
- when "run_list"
58
- project_id = Souls.configuration.project_id
59
- Souls::Gcloud.run_list(project_id: project_id)
60
- when "run_awake"
61
- app_name = Souls.configuration.app
62
- Souls::Gcloud.run_awake(app_name: app_name)
63
- else
64
- raise(StandardError, "Wrong Method!")
65
- end
66
- end
67
- end
68
- end
69
- end