souls 1.2.0 → 1.3.1

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: 88330b37a9727d21e018e0415ee1c9fb13954d78397dd099d7c7273e99831369
4
- data.tar.gz: edb15c60919ef2a5ba510652e546fb7438cdd5dc32760f10cdd8e729d4aa3f92
3
+ metadata.gz: 9586ab30b5189eaa4af5cbd037ad0650d78a0ce8c89fd1591528d7ec4da70d8a
4
+ data.tar.gz: 14087a6358389fdc3f0de14ac3cde00233add048add040f379e229239d0f954f
5
5
  SHA512:
6
- metadata.gz: 4252ee302de5e2cbd99cbb67f33d868ecb38929d0dd4af71e58c7d20aae2b44f26b8071af3f4ae1ead6bac67aaa2f8d47ebb1ead5b8c3b6ad9cddbe87f87cece
7
- data.tar.gz: 42a8d5649089e2212cbe79c9e4e3a8496acbb32374707defc1f67f7f2eb53ff2e8abb9bc20219cb73df5289f78e9adb2d1f1d9da4945dae1c7e88429272e82c6
6
+ metadata.gz: e28e330548810a8804c51b287e4991c973fc918a5c2b8dab694a9998e6d5e930dc7a53cff8b33fb23db5f4ba501bea42bd931fb0c6d769f7f1bd6f287b91a768
7
+ data.tar.gz: eafd2c306469f2685fa93acd474afd51c729469bcc0721b7157c269a760364d84271ba7698f3bb20fcdd1872c2bf9ea1c20ddf583f5ce6deff795e879769ad64
@@ -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}\n"
22
+ lines[1] = "DB_PW=#{options[:root_password]}\n"
23
+ lines[2] = "DB_USER=postgres\n"
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
@@ -1,12 +1,5 @@
1
1
  module Souls
2
2
  class Github < Thor
3
- desc "auth_login", "gcloud config set and gcloud auth login"
4
- def auth_login
5
- system("gh auth login")
6
- rescue Thor::Error => e
7
- raise(Thor::Error, e)
8
- end
9
-
10
3
  desc "secret_set", "Github Secret Set by Github CLI"
11
4
  def secret_set
12
5
  require("#{Souls.get_api_path}/config/souls")
@@ -14,7 +7,7 @@ module Souls
14
7
  File.open(file_path, "r") do |file|
15
8
  file.each_line do |line|
16
9
  key_and_value = line.split("=")
17
- system("gh secret set #{key_and_value[0]} -b \"#{key_and_value[1]}\"")
10
+ system("gh secret set #{key_and_value[0]} -b \"#{key_and_value[1].strip}\"")
18
11
  end
19
12
  end
20
13
  end
@@ -159,6 +159,7 @@ module Souls
159
159
  system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Procfile")
160
160
  system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/Steepfile")
161
161
  system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/gitignore")
162
+ system("cd #{app_name} && curl -OL https://storage.googleapis.com/souls-bucket/boilerplates/.env.production.sample")
162
163
  system("cd #{app_name} && mv gitignore .gitignore")
163
164
  system("cd #{app_name} && bundle")
164
165
  system("cd #{app_name}/apps/api && bundle")
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.3.1".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.1
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.1
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.0
4
+ version: 1.3.1
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