souls 1.2.1 → 1.3.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: daa0fac1d0cbc60e712994999aa2cdac65ba83154d003e890cf6f68344beb07c
4
- data.tar.gz: decaf9ee99e0916b38760fd8e03ad3405c1919f0e08cac06b165a328aa38d1c1
3
+ metadata.gz: e903e408a1e67cf84a2817b0e7144eec61a5c07011b9f2299b4d3b01fdcf4c2e
4
+ data.tar.gz: 0572dec02f099651cdc15625eb75189c454aa3b61bdba20bd551c1f9dfe88bd7
5
5
  SHA512:
6
- metadata.gz: 18b297acd49876c7f9cbc568dc0f7c1ce2f72ac51c6d783ba6f3d308c422b4b122ccbfc936a02b86eb41bb74b8f901ca6ffdf0bbf6927cd5c13b6d3f3858e3a7
7
- data.tar.gz: 81c1fca2ce6888521ad232fb761f4b73785a921942313695c6fdd0daf714ededb61cc34770575966fb9f7230c39ea5deb97b2301e2eae4cfea2b65cef0e1e62a
6
+ metadata.gz: 775426654c16e931505331ff4cc383c6652244b4fe76f9df41b5e3fefc287ee3a1c38b0adf4234a1c9069abc568678cdebafd06b09f95067f5cf6192264d1d39
7
+ data.tar.gz: 3602a072188c4f27d7292a8428cbe82d8188b1de2b23a6ef6bf9f8a2675c036fd5ea6a10f68833a5c63753d996144f2cc80cf63a2eb60538fd371716ebe981fa
@@ -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.configuration.instance_name 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
@@ -35,7 +46,7 @@ module Souls
35
46
  desc "assign_network", "Assign Network"
36
47
  def assign_network
37
48
  app_name = Souls.configuration.app
38
- instance_name = "#{Souls.configuration.app}-db"
49
+ instance_name = Souls.configuration.instance_name
39
50
  project_id = Souls.configuration.project_id
40
51
  system("gcloud beta sql instances patch #{instance_name} --project=#{project_id} --network=#{app_name}")
41
52
  rescue Thor::Error => e
@@ -80,8 +91,8 @@ module Souls
80
91
  desc "assgin_ip", "Add Current Grobal IP to White List"
81
92
  def assign_ip(instance_name: "", ip: "")
82
93
  ip = `curl inet-ip.info` if ip.blank?
83
- project_id = Souls.configuration.project_id
84
- instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
94
+ project_id = Souls.configuration.project_id if instance_name.blank?
95
+ instance_name = Souls.configuration.instance_name if instance_name.blank?
85
96
  system(
86
97
  "
87
98
  gcloud beta sql instances patch #{instance_name} \
@@ -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")
@@ -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.1".freeze
2
+ VERSION = "1.3.2".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.3.2
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.3.2
data/lib/souls.rb CHANGED
@@ -49,5 +49,9 @@ module Souls
49
49
  @fixed_gems = nil
50
50
  @workers = nil
51
51
  end
52
+
53
+ def instance_name
54
+ "souls-#{@app}-db"
55
+ end
52
56
  end
53
57
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
8
8
  - KishiTheMechanic
9
9
  - James Neve
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-10-26 00:00:00.000000000 Z
13
+ date: 2021-11-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -231,7 +231,7 @@ metadata:
231
231
  homepage_uri: https://souls.elsoul.nl
232
232
  source_code_uri: https://github.com/elsoul/souls
233
233
  changelog_uri: https://github.com/elsoul/souls
234
- post_install_message:
234
+ post_install_message:
235
235
  rdoc_options: []
236
236
  require_paths:
237
237
  - lib
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  version: '0'
248
248
  requirements: []
249
249
  rubygems_version: 3.2.22
250
- signing_key:
250
+ signing_key:
251
251
  specification_version: 4
252
252
  summary: Build Serverless Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep,
253
253
  Active Record, RSpec, RuboCop, and Google Cloud.