souls 1.3.0 → 1.3.4

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: 2a268cc2c1da6a5192359f7ac46028f340b066ba8fd52b79f17639b1e0ee97fd
4
- data.tar.gz: 571e1896e5ce83ea3813457cd3f4aa094d295b03340781b08f19b92cef626728
3
+ metadata.gz: db171a41f8de9bb4f402c769cd2c46dbba8ca747175e70e8a61ae6c8c4298a40
4
+ data.tar.gz: b8efa059a87e83ffa2753fe7f91df0df7049fdf64f3f301bdcab73d753458ba1
5
5
  SHA512:
6
- metadata.gz: bcf221fef615359fe8be1f979cf76ae54e773ef8075c49940989df5c2fd0cc37ee104dcfbf0b2ce441cc80316dd2f10a84d051746def38dd2706f51494314c8f
7
- data.tar.gz: a5a2fd8e0b9b2374750941656ccd63b3362e159a4cad2df2e00ac8caefd226a9e90d6c54da6b3b7982b61a33ee0dd1d0834872c11fcfc3276913d2550dec926c
6
+ metadata.gz: 79a2a2a9f9f8266861cd9363f7299576bd227224a3ef6e78e2e566067b14535547b399862d558eb9133474c8be185e5220e3785a6f6d43c48ac04732864d1a51
7
+ data.tar.gz: e434dec7a31f610a65083574e09abefee38b3438b58eb28c4a2dec94c82463d3a4b0ed2b685d3da94061badcfdec72c365f4f8da4dc6b9d473d9524b9b85c910
data/README.md CHANGED
@@ -68,6 +68,7 @@ It is a development environment where you can immediately notice the mistakes th
68
68
  - [Docker](https://www.docker.com/)
69
69
  - [Firebase CLI](https://firebase.google.com/docs/cli)
70
70
  - [Ruby](https://www.ruby-lang.org)
71
+ - [Github CLI](https://cli.github.com/)
71
72
 
72
73
  ## Cloud Infrastructure
73
74
 
@@ -192,7 +192,7 @@ end
192
192
  --service-account=${{ secrets.APP_NAME }}@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com \\
193
193
  --image=gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{secrets.APP_NAME}}-#{worker_name} \\
194
194
  --memory=4Gi \\
195
- --region=asia-northeast1 \\
195
+ --region=${{ secrets.GCP_REGION }} \\
196
196
  --allow-unauthenticated \\
197
197
  --platform=managed \\
198
198
  --quiet \\
@@ -5,23 +5,48 @@ module Souls
5
5
  method_option :root_password, default: "", aliases: "--root-password", desc: "Set Cloud SQL Root Password"
6
6
  method_option :mysql, type: :boolean, default: false, aliases: "--mysql", desc: "Set Cloud SQL Type to MySQL"
7
7
  def create_instance
8
- instance_name = "souls-#{Souls.configuration.app}-db" if instance_name.blank?
8
+ app_name = Souls.configuration.app
9
+ project_id = Souls.configuration.project_id
10
+ region = Souls.configuration.region
11
+ instance_name = Souls.configuration.instance_name if instance_name.blank?
9
12
  region = Souls.configuration.region if options[:region].blank?
10
13
  db_type = options[:mysql] ? "MYSQL_8_0" : "POSTGRES_13"
11
14
 
12
15
  zone = "#{region}-b"
13
16
  system(
14
17
  "gcloud sql instances create #{instance_name} \
15
- --database-version=#{db_type} --cpu=2 --memory=7680MB --zone=#{zone} \
18
+ --database-version=#{db_type} --cpu=1 --memory=3750MB --zone=#{zone} \
16
19
  --root-password='#{options[:root_password]}' --database-flags cloudsql.iam_authentication=on"
17
20
  )
18
21
  Dir.chdir(Souls.get_api_path.to_s) do
19
22
  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) }
23
+ File.open(file_path, "w") do |line|
24
+ line.write(<<~TEXT)
25
+ DB_HOST=#{get_sql_ip.strip}
26
+ DB_PW=#{options[:root_password]}
27
+ DB_USER=postgres
28
+ SLACK=YOUR_WEB_HOOK_URL
29
+ TZ="Asia/Tokyo"
30
+ SECRET_KEY_BASE=xxxxxxxxxxxxxx
31
+ TEXT
32
+ end
33
+ end
34
+ Dir.chdir(Souls.get_mother_path.to_s) do
35
+ file_path = ".env.production"
36
+ File.open(file_path, "w") do |line|
37
+ line.write(<<~TEXT)
38
+ DB_HOST="/cloudsql/#{project_id}:#{region}:#{instance_name}"
39
+ DB_PW=#{options[:root_password]}
40
+ DB_USER=postgres
41
+ APP_NAME=#{app_name}
42
+ GCP_PROJECT_ID=#{project_id}
43
+ GCP_REGION=#{region}
44
+ GCLOUDSQL_INSTANCE="#{project_id}:#{region}:#{instance_name}"
45
+ TZ="Asia/Tokyo"
46
+ SLACK="https://YOUR.WEB_HOOK_URL"
47
+ SECRET_KEY_BASE="XXXXXXXSecureTokenXXXXXXXXXX"
48
+ TEXT
49
+ end
25
50
  end
26
51
  rescue Thor::Error => e
27
52
  raise(Thor::Error, e)
@@ -46,7 +71,7 @@ module Souls
46
71
  desc "assign_network", "Assign Network"
47
72
  def assign_network
48
73
  app_name = Souls.configuration.app
49
- instance_name = "#{Souls.configuration.app}-db"
74
+ instance_name = Souls.configuration.instance_name
50
75
  project_id = Souls.configuration.project_id
51
76
  system("gcloud beta sql instances patch #{instance_name} --project=#{project_id} --network=#{app_name}")
52
77
  rescue Thor::Error => e
@@ -91,8 +116,8 @@ module Souls
91
116
  desc "assgin_ip", "Add Current Grobal IP to White List"
92
117
  def assign_ip(instance_name: "", ip: "")
93
118
  ip = `curl inet-ip.info` if ip.blank?
94
- project_id = Souls.configuration.project_id
95
- instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
119
+ project_id = Souls.configuration.project_id if instance_name.blank?
120
+ instance_name = Souls.configuration.instance_name if instance_name.blank?
96
121
  system(
97
122
  "
98
123
  gcloud beta sql instances patch #{instance_name} \
@@ -119,15 +119,15 @@ module Souls
119
119
 
120
120
  gem "activesupport", "6.1.4.1"
121
121
  gem "foreman", "0.87.2"
122
- gem "google-cloud-pubsub", "2.8.1"
122
+ gem "google-cloud-pubsub", "2.9.0"
123
123
  gem "paint", "2.2.1"
124
124
  gem "parser", "3.0.2.0"
125
125
  gem "pg", "1.2.3"
126
126
  gem "rake", "13.0.6"
127
127
  gem "rspec", "3.10.0"
128
- gem "rubocop", "1.21.0"
128
+ gem "rubocop", "1.22.3"
129
129
  gem "sinatra-activerecord", "2.0.23"
130
- gem "solargraph", "0.43.2"
130
+ gem "solargraph", "0.44.0"
131
131
  gem "souls", "#{Souls::VERSION}"
132
132
  gem "steep", "0.46.0"
133
133
  gem "thor", "1.1.0"
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.3.0".freeze
2
+ VERSION = "1.3.4".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.4
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.4
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.4
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-29 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