souls 1.7.17 → 1.7.21

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: b8560ec99f77c37368f51c3789321bfd5dbe31e608120bbc65ec5ea0acd10951
4
- data.tar.gz: 84d9f6296c4a2de4ba81c7c0119aa638970ff4069059f69138323bf69c0ce8ac
3
+ metadata.gz: 7f1736fff66eb0bdd349eafd3b60078309b0e51389223376f783ed21fb97c0bc
4
+ data.tar.gz: 50c2333fae0fd7e94ff18661990df02b059e385e76cad90d7886643285ba3b69
5
5
  SHA512:
6
- metadata.gz: 83306246c2dfae595463aa032aba8b3969d5478313e833cd95a137ef9b649154008bc4241521a737a4a73c929c863f00ddae1a5bb2090ea5431afbf68a07e50b
7
- data.tar.gz: e9024433a7e2e83347340bc89a094f4a5cf4643973dc9ae0613a2704f3c51cf14ce971d812c3f8cdba397e6526b218326215d8e9b30c0fe67fe0c2c529b14bb2
6
+ metadata.gz: bc8113fde23630ec893dec10fabafaf611c5cdd67c02447f79ce934ba114a63c8a6011553dafd62ca367ddcd50ab6657d5eaa33751bf5198a89e100e61dafbdd
7
+ data.tar.gz: 22447d85e057a9221bcdae949f5504bbdfdfe14caa32d0290f800ca47d1d148eadf228c140d29e9c6cb4ae61ebcee2762cd3018322add8967d1379e8b2954e8a
@@ -7,4 +7,24 @@ module Souls
7
7
  @message = message
8
8
  end
9
9
  end
10
+
11
+ class PSQLException < CLIException
12
+ attr_reader :message
13
+
14
+ def initialize
15
+ message = "It looks like there was a problem with the DB. Make sure PSQL is running with 'souls docker psql'"
16
+ super(message)
17
+ @message = message
18
+ end
19
+ end
20
+
21
+ class GcloudException < CLIException
22
+ attr_reader :message
23
+
24
+ def initialize
25
+ message = "You either haven't created or don't have access to a GCP project. Please create a GCP project with the same name as this app."
26
+ super(message)
27
+ @message = message
28
+ end
29
+ end
10
30
  end
@@ -2,6 +2,8 @@ require_relative "./create_migration_rbs"
2
2
  require_relative "./model"
3
3
  require_relative "./rspec_model"
4
4
  require_relative "./model_rbs"
5
+ require_relative "../cli_exception"
6
+
5
7
  module Souls
6
8
  class DB < Thor
7
9
  desc "migrate", "Migrate Database"
@@ -9,10 +11,10 @@ module Souls
9
11
  def migrate
10
12
  case options[:env]
11
13
  when "production"
12
- system("rake db:migrate RACK_ENV=production")
14
+ db_system("rake db:migrate RACK_ENV=production")
13
15
  else
14
- system("rake db:migrate")
15
- system("rake db:migrate RACK_ENV=test")
16
+ db_system("rake db:migrate")
17
+ db_system("rake db:migrate RACK_ENV=test")
16
18
  end
17
19
  true
18
20
  rescue Thor::Error => e
@@ -24,9 +26,9 @@ module Souls
24
26
  def create
25
27
  case options[:env]
26
28
  when "production"
27
- system("rake db:create RACK_ENV=production")
29
+ db_system("rake db:create RACK_ENV=production")
28
30
  else
29
- system("rake db:create")
31
+ db_system("rake db:create")
30
32
  end
31
33
  rescue Thor::Error => e
32
34
  raise(Thor::Error, e)
@@ -37,10 +39,10 @@ module Souls
37
39
  def seed
38
40
  case options[:env]
39
41
  when "production"
40
- system("rake db:seed RACK_ENV=production")
42
+ db_system("rake db:seed RACK_ENV=production")
41
43
  else
42
- system("rake db:seed")
43
- system("rake db:seed RACK_ENV=test")
44
+ db_system("rake db:seed")
45
+ db_system("rake db:seed RACK_ENV=test")
44
46
  end
45
47
  rescue Thor::Error => e
46
48
  raise(Thor::Error, e)
@@ -51,9 +53,9 @@ module Souls
51
53
  def migrate_reset
52
54
  case options[:env]
53
55
  when "production"
54
- system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
56
+ db_system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
55
57
  else
56
- system("rake db:migrate:reset")
58
+ db_system("rake db:migrate:reset")
57
59
  end
58
60
  rescue Thor::Error => e
59
61
  raise(Thor::Error, e)
@@ -125,5 +127,11 @@ module Souls
125
127
  rescue Thor::Error => e
126
128
  raise(Thor::Error, e)
127
129
  end
130
+
131
+ private
132
+
133
+ def db_system(cmd)
134
+ system(cmd) or raise(Souls::PSQLException)
135
+ end
128
136
  end
129
137
  end
@@ -3,6 +3,7 @@ require_relative "./pubsub/index"
3
3
  require_relative "./run/index"
4
4
  require_relative "./sql/index"
5
5
  require_relative "./compute/index"
6
+ require_relative "../cli_exception"
6
7
 
7
8
  module Souls
8
9
  class Gcloud < Thor
@@ -26,6 +27,7 @@ module Souls
26
27
  desc "auth_login", "gcloud config set and gcloud auth login"
27
28
  def auth_login
28
29
  project_id = Souls.configuration.project_id
30
+ system("gcloud projects describe #{project_id}", out: :close) or raise(Souls::GcloudException)
29
31
  system("gcloud config set project #{project_id}")
30
32
  system("gcloud auth login")
31
33
  rescue Thor::Error => e
@@ -34,8 +36,8 @@ module Souls
34
36
 
35
37
  desc "config_set", "gcloud config set"
36
38
  def config_set
37
- require("#{Souls.get_api_path}/config/souls")
38
39
  project_id = Souls.configuration.project_id
40
+ system("gcloud projects describe #{project_id}", out: :close) or raise(Souls::GcloudException)
39
41
  system("gcloud config set project #{project_id}")
40
42
  end
41
43
 
@@ -13,7 +13,7 @@ module Souls
13
13
  exit
14
14
  end
15
15
  file_dir = "./#{app_name}"
16
- raise(StandardError, "Directory Already Exist!") if Dir.exist?(file_dir)
16
+ raise(StandardError, "Directory already exists and is not empty") if Dir.exist?(file_dir) && !Dir.empty?(file_dir)
17
17
 
18
18
  service_name = "api"
19
19
  download_souls(app_name: app_name, service_name: service_name)
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "1.7.17".freeze
2
+ VERSION = "1.7.21".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 1.7.17
1
+ 1.7.21
@@ -1 +1 @@
1
- 1.7.17
1
+ 1.7.21
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.7.17
4
+ version: 1.7.21
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-11-15 00:00:00.000000000 Z
13
+ date: 2021-11-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -226,8 +226,8 @@ licenses:
226
226
  metadata:
227
227
  homepage_uri: https://souls.elsoul.nl
228
228
  source_code_uri: https://github.com/elsoul/souls
229
- changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.7.17
230
- post_install_message:
229
+ changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.7.21
230
+ post_install_message:
231
231
  rdoc_options: []
232
232
  require_paths:
233
233
  - lib
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  version: '0'
244
244
  requirements: []
245
245
  rubygems_version: 3.2.22
246
- signing_key:
246
+ signing_key:
247
247
  specification_version: 4
248
248
  summary: Build Serverless Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep,
249
249
  Active Record, RSpec, RuboCop, and Google Cloud.