souls 1.7.18 → 1.7.24
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 +4 -4
- data/lib/souls/cli/cli_exception.rb +21 -0
- data/lib/souls/cli/console/index.rb +2 -1
- data/lib/souls/cli/db/index.rb +18 -10
- data/lib/souls/cli/gcloud/index.rb +3 -1
- data/lib/souls/cli/generate/mutation_rbs.rb +12 -3
- data/lib/souls/cli/init/index.rb +1 -1
- data/lib/souls/cli/update/mutation.rb +12 -4
- data/lib/souls/cli/update/mutation_rbs.rb +6 -5
- data/lib/souls/cli/update/resolver.rb +8 -5
- data/lib/souls/cli/update/rspec_mutation.rb +4 -2
- data/lib/souls/cli/upgrade/index.rb +1 -1
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- metadata +6 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c731aa9244ceb825af39c837fe0be223a8b6d1df9a64cbb16a3767d0650c8147
|
4
|
+
data.tar.gz: 30814435a8d524bc1021bfa2a31dcb88f9f9f4fc373b8d17c219d9ca9b0744a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 153d93623299b56bbf5e51d343165e7e99025ab5f04cff92674080c3a05140db83d3fc09b428d01d7c4bffc26e96d79a4b7e0260f0828eb3496e8d8432b26169
|
7
|
+
data.tar.gz: f0c04fb0f44d02aff9979f26869aed96be3e059610c4485e392c8e10b95c4f884c0a7341f2b2d163c2d1e726410fb6e6bd9aa6c6a794c0dbf44f80f452c6c0bf
|
@@ -7,4 +7,25 @@ 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. " \
|
26
|
+
"Please create a GCP project with the same name as this app."
|
27
|
+
super(message)
|
28
|
+
@message = message
|
29
|
+
end
|
30
|
+
end
|
10
31
|
end
|
@@ -3,7 +3,8 @@ module Souls
|
|
3
3
|
desc "console", "Run IRB Console"
|
4
4
|
method_option :env, aliases: "--e", default: "development", desc: "Difine APP Enviroment - development | production"
|
5
5
|
def console
|
6
|
-
return system("RACK_ENV=production bundle exec irb") if options[:env].eql?
|
6
|
+
return system("RACK_ENV=production bundle exec irb") if options[:env].eql?("production")
|
7
|
+
|
7
8
|
system("bundle exec irb")
|
8
9
|
end
|
9
10
|
end
|
data/lib/souls/cli/db/index.rb
CHANGED
@@ -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
|
-
|
14
|
+
db_system("rake db:migrate RACK_ENV=production")
|
13
15
|
else
|
14
|
-
|
15
|
-
|
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
|
-
|
29
|
+
db_system("rake db:create RACK_ENV=production")
|
28
30
|
else
|
29
|
-
|
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
|
-
|
42
|
+
db_system("rake db:seed RACK_ENV=production")
|
41
43
|
else
|
42
|
-
|
43
|
-
|
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
|
-
|
56
|
+
db_system("rake db:migrate:reset RACK_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1")
|
55
57
|
else
|
56
|
-
|
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: File::NULL) 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: File::NULL) or raise(Souls::GcloudException)
|
39
41
|
system("gcloud config set project #{project_id}")
|
40
42
|
end
|
41
43
|
|
@@ -62,14 +62,23 @@ module Souls
|
|
62
62
|
type = "[#{type}]" if param[:array]
|
63
63
|
if i.zero?
|
64
64
|
if param[:column_name].match?(/$*_id\z/)
|
65
|
-
f.write(
|
65
|
+
f.write(
|
66
|
+
" def self.argument: (:#{param[:column_name]}, String, " \
|
67
|
+
"required: false ) -> #{rbs_type}\n"
|
68
|
+
)
|
66
69
|
else
|
67
|
-
f.write(
|
70
|
+
f.write(
|
71
|
+
" def self.argument: (:#{param[:column_name]}, #{type}, " \
|
72
|
+
"required: false ) -> #{rbs_type}\n"
|
73
|
+
)
|
68
74
|
end
|
69
75
|
elsif param[:column_name].match?(/$*_id\z/)
|
70
76
|
f.write(" | (:#{param[:column_name]}, String, required: false ) -> String\n")
|
71
77
|
else
|
72
|
-
f.write(
|
78
|
+
f.write(
|
79
|
+
" | (:#{param[:column_name]}, #{type}, " \
|
80
|
+
"required: false ) -> #{rbs_type}\n"
|
81
|
+
)
|
73
82
|
end
|
74
83
|
end
|
75
84
|
end
|
data/lib/souls/cli/init/index.rb
CHANGED
@@ -13,7 +13,7 @@ module Souls
|
|
13
13
|
exit
|
14
14
|
end
|
15
15
|
file_dir = "./#{app_name}"
|
16
|
-
raise(StandardError, "Directory
|
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)
|
@@ -8,8 +8,12 @@ module Souls
|
|
8
8
|
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
9
9
|
dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
|
10
10
|
file_path = "#{dir_name}/create_#{singularized_class_name}.rb"
|
11
|
-
|
12
|
-
|
11
|
+
unless File.exist?(file_path)
|
12
|
+
raise(
|
13
|
+
Souls::CLIException,
|
14
|
+
"File #{file_path} is missing. Please recreate it and then run this command again."
|
15
|
+
)
|
16
|
+
end
|
13
17
|
|
14
18
|
mutation_argument = check_mutation_argument(class_name: "user", action: "create")
|
15
19
|
overwrite_class_file(mutation_argument: mutation_argument, file_path: file_path, new_cols: new_cols)
|
@@ -22,8 +26,12 @@ module Souls
|
|
22
26
|
new_cols = Souls.get_columns_num(class_name: singularized_class_name)
|
23
27
|
dir_name = "./app/graphql/mutations/base/#{singularized_class_name}"
|
24
28
|
file_path = "#{dir_name}/update_#{singularized_class_name}.rb"
|
25
|
-
|
26
|
-
|
29
|
+
unless File.exist?(file_path)
|
30
|
+
raise(
|
31
|
+
Souls::CLIException,
|
32
|
+
"File #{file_path} is missing. Please recreate it and then run this command again."
|
33
|
+
)
|
34
|
+
end
|
27
35
|
|
28
36
|
mutation_argument = check_mutation_argument(class_name: class_name, action: "update")
|
29
37
|
overwrite_class_file(mutation_argument: mutation_argument, file_path: file_path, new_cols: new_cols)
|
@@ -27,11 +27,12 @@ module Souls
|
|
27
27
|
type = "[#{type}]" if col[:array]
|
28
28
|
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
write_txt +=
|
31
|
+
if i.zero?
|
32
|
+
line
|
33
|
+
else
|
34
|
+
" #{col[:column_name]}: #{type}?,\n"
|
35
|
+
end
|
35
36
|
end
|
36
37
|
resolve = true
|
37
38
|
elsif line.include?("def self.argument:") && !argument
|
@@ -28,11 +28,14 @@ module Souls
|
|
28
28
|
type = Souls.type_check(col[:type])
|
29
29
|
type = "[#{type}]" if col[:array]
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
add_line =
|
32
|
+
if type.include?("[")
|
33
|
+
" scope = scope.where('#{col[:column_name]} @> ARRAY[?]::#{col[:type]}[]', " \
|
34
|
+
"value[:#{col[:column_name]}]) if value[:#{col[:column_name]}]\n"
|
35
|
+
else
|
36
|
+
" scope = scope.where(#{col[:column_name]}: value[:#{col[:column_name]}]) if " \
|
37
|
+
"value[:#{col[:column_name]}]\n"
|
38
|
+
end
|
36
39
|
new_line.write(add_line) unless scope_args.include?(col[:column_name])
|
37
40
|
end
|
38
41
|
scope = true
|
@@ -26,9 +26,11 @@ module Souls
|
|
26
26
|
|
27
27
|
type_line =
|
28
28
|
if type == "String" && !col[:array]
|
29
|
-
" #{col[:column_name].camelize(:lower)}
|
29
|
+
" #{col[:column_name].camelize(:lower)}" \
|
30
|
+
": \"\#{#{class_name}[:#{col[:column_name].underscore}]}\"\n"
|
30
31
|
else
|
31
|
-
" #{col[:column_name].camelize(:lower)}
|
32
|
+
" #{col[:column_name].camelize(:lower)}" \
|
33
|
+
": \#{#{class_name}[:#{col[:column_name].underscore}]}\n"
|
32
34
|
end
|
33
35
|
args = check_rspec_mutation_argument(class_name: class_name)
|
34
36
|
new_line.write(type_line) unless args.include?(col[:column_name].underscore)
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.24
|
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.24
|
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.
|
4
|
+
version: 1.7.24
|
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-
|
13
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -224,10 +224,8 @@ homepage: https://souls.elsoul.nl
|
|
224
224
|
licenses:
|
225
225
|
- Apache-2.0
|
226
226
|
metadata:
|
227
|
-
|
228
|
-
|
229
|
-
changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.7.18
|
230
|
-
post_install_message:
|
227
|
+
rubygems_mfa_required: 'true'
|
228
|
+
post_install_message:
|
231
229
|
rdoc_options: []
|
232
230
|
require_paths:
|
233
231
|
- lib
|
@@ -243,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
241
|
version: '0'
|
244
242
|
requirements: []
|
245
243
|
rubygems_version: 3.2.22
|
246
|
-
signing_key:
|
244
|
+
signing_key:
|
247
245
|
specification_version: 4
|
248
246
|
summary: Build Serverless Apps faster like Rails. Powered by Ruby GraphQL, RBS/Steep,
|
249
247
|
Active Record, RSpec, RuboCop, and Google Cloud.
|