souls 1.2.2 → 1.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a268cc2c1da6a5192359f7ac46028f340b066ba8fd52b79f17639b1e0ee97fd
|
4
|
+
data.tar.gz: 571e1896e5ce83ea3813457cd3f4aa094d295b03340781b08f19b92cef626728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcf221fef615359fe8be1f979cf76ae54e773ef8075c49940989df5c2fd0cc37ee104dcfbf0b2ce441cc80316dd2f10a84d051746def38dd2706f51494314c8f
|
7
|
+
data.tar.gz: a5a2fd8e0b9b2374750941656ccd63b3362e159a4cad2df2e00ac8caefd226a9e90d6c54da6b3b7982b61a33ee0dd1d0834872c11fcfc3276913d2550dec926c
|
data/lib/souls/cli/db/index.rb
CHANGED
@@ -3,15 +3,26 @@ module Souls
|
|
3
3
|
desc "create_instance", "Create Google Cloud SQL - PostgreSQL13"
|
4
4
|
method_option :region, default: "", aliases: "--region", desc: "Google Cloud Platform Region"
|
5
5
|
method_option :root_password, default: "", aliases: "--root-password", desc: "Set Cloud SQL Root Password"
|
6
|
+
method_option :mysql, type: :boolean, default: false, aliases: "--mysql", desc: "Set Cloud SQL Type to MySQL"
|
6
7
|
def create_instance
|
7
|
-
instance_name = "
|
8
|
+
instance_name = "souls-#{Souls.configuration.app}-db" if instance_name.blank?
|
8
9
|
region = Souls.configuration.region if options[:region].blank?
|
10
|
+
db_type = options[:mysql] ? "MYSQL_8_0" : "POSTGRES_13"
|
11
|
+
|
9
12
|
zone = "#{region}-b"
|
10
13
|
system(
|
11
14
|
"gcloud sql instances create #{instance_name} \
|
12
|
-
--database-version
|
15
|
+
--database-version=#{db_type} --cpu=2 --memory=7680MB --zone=#{zone} \
|
13
16
|
--root-password='#{options[:root_password]}' --database-flags cloudsql.iam_authentication=on"
|
14
17
|
)
|
18
|
+
Dir.chdir(Souls.get_api_path.to_s) do
|
19
|
+
file_path = ".env"
|
20
|
+
lines = File.readlines(".env")
|
21
|
+
lines[0] = "DB_HOST=#{get_sql_ip.strip}" << $RS
|
22
|
+
lines[1] = "DB_PW=#{options[:root_password]}" << $RS
|
23
|
+
lines[2] = "DB_USER=#{instance_name}" << $RS
|
24
|
+
File.open(file_path, "w") { |f| f.write(lines.join) }
|
25
|
+
end
|
15
26
|
rescue Thor::Error => e
|
16
27
|
raise(Thor::Error, e)
|
17
28
|
end
|
@@ -94,5 +105,11 @@ module Souls
|
|
94
105
|
rescue Thor::Error => e
|
95
106
|
raise(Thor::Error, e)
|
96
107
|
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def get_sql_ip
|
112
|
+
`gcloud sql instances list | grep james | awk '{print $5}'`
|
113
|
+
end
|
97
114
|
end
|
98
115
|
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
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.
|
4
|
+
version: 1.3.0
|
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-10-
|
13
|
+
date: 2021-10-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|