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: dfd94cb490b6572839d1bbe81210f365501d29746db52da19b7802a989389f78
4
- data.tar.gz: ff24ba19313ef53a5b0be3650902963aa1035e86f26a44819431ec2c9a9290e0
3
+ metadata.gz: 2a268cc2c1da6a5192359f7ac46028f340b066ba8fd52b79f17639b1e0ee97fd
4
+ data.tar.gz: 571e1896e5ce83ea3813457cd3f4aa094d295b03340781b08f19b92cef626728
5
5
  SHA512:
6
- metadata.gz: 71400c705f4fef455e14adf98ac5f2ad51ff98ec751a6ee3ff0f08ad828d238d3383256464f7e9932035ac86dc7bfb10de756c2bb1dc90932ee812304d1bab73
7
- data.tar.gz: 0c19435dad07d1e8f69213a52522d8f46c48140b415c3f420eb556a8448d003a70626132d4229a413d5518835bcf2e5c55ffe63a2cb510e2f2bc0d32987a42ec
6
+ metadata.gz: bcf221fef615359fe8be1f979cf76ae54e773ef8075c49940989df5c2fd0cc37ee104dcfbf0b2ce441cc80316dd2f10a84d051746def38dd2706f51494314c8f
7
+ data.tar.gz: a5a2fd8e0b9b2374750941656ccd63b3362e159a4cad2df2e00ac8caefd226a9e90d6c54da6b3b7982b61a33ee0dd1d0834872c11fcfc3276913d2550dec926c
@@ -55,7 +55,6 @@ module Souls
55
55
  system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
56
56
  else
57
57
  system("rake db:migrate:reset")
58
- system("rake db:migrate:reset RACK_ENV=test")
59
58
  end
60
59
  rescue Thor::Error => e
61
60
  raise(Thor::Error, e)
@@ -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 = "#{Souls.configuration.app}-db" if instance_name.blank?
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=POSTGRES_13 --cpu=2 --memory=7680MB --zone=#{zone} \
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,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.2.2".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.3.0
@@ -1 +1 @@
1
- 1.2.2
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.2.2
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-26 00:00:00.000000000 Z
13
+ date: 2021-10-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport