souls 0.47.1 → 0.49.0
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/exe/souls +32 -30
- data/lib/souls/api/generate/application.rb +1 -64
- data/lib/souls/api/generate/index.rb +10 -0
- data/lib/souls/api/generate/mutation.rb +4 -4
- data/lib/souls/api/generate/resolver.rb +5 -5
- data/lib/souls/api/generate/rspec_factory.rb +2 -2
- data/lib/souls/api/generate/rspec_mutation.rb +5 -5
- data/lib/souls/api/generate/rspec_query.rb +4 -4
- data/lib/souls/api/generate/rspec_resolver.rb +4 -4
- data/lib/souls/api/generate/type.rb +2 -2
- data/lib/souls/api/update/mutation.rb +2 -2
- data/lib/souls/api/update/resolver.rb +2 -2
- data/lib/souls/api/update/rspec_factory.rb +1 -1
- data/lib/souls/api/update/rspec_mutation.rb +2 -2
- data/lib/souls/api/update/rspec_resolver.rb +1 -1
- data/lib/souls/api/update/type.rb +1 -1
- data/lib/souls/cli/console/index.rb +4 -0
- data/lib/souls/cli/create/index.rb +2 -10
- data/lib/souls/cli/db/index.rb +4 -0
- data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +4 -0
- data/lib/souls/cli/gcloud/pubsub/topics.rb +4 -0
- data/lib/souls/cli/gcloud/sql/index.rb +12 -4
- data/lib/souls/cli/index.rb +4 -0
- data/lib/souls/cli/init/index.rb +155 -0
- data/lib/souls/cli/release/release.rb +91 -3
- data/lib/souls/cli/server/index.rb +4 -0
- data/lib/souls/cli/sync/conf.rb +18 -8
- data/lib/souls/index.rb +0 -1
- data/lib/souls/utils/index.rb +177 -0
- 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
- data/lib/souls.rb +2 -212
- metadata +9 -6
- data/lib/souls/init.rb +0 -153
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acb1a478eea7adee5b08030cc7684079c61c2923638a26a12283ea1415a83578
|
4
|
+
data.tar.gz: 7f705d45cfc5172d6ef3e9a3d2194113a8d698056457c28b541eb114acea93b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 569f199d2f30351f729939d09ed6cd63bd1d254f15b1750ebca5b07c7ebde57ebf9405c03861af4cd73d40adaa460b1550fedaf4dc5187f165724e0d01f89ba8
|
7
|
+
data.tar.gz: 53082a4de7a34616c46e8015ac89fefedff53162434041d351575d258e3f5498184f270d8aae42c46e9790b64e0eabab495038129d3f7c49fe41773cea761c7d
|
data/exe/souls
CHANGED
@@ -10,37 +10,39 @@ begin
|
|
10
10
|
case souls_command
|
11
11
|
when "api"
|
12
12
|
api_command = ARGV[1]
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
Whirly.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Whirly.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
13
|
+
Dir.chdir(Souls.get_api_path.to_s) do
|
14
|
+
case api_command
|
15
|
+
when "generate", "g"
|
16
|
+
method_name = ARGV[2]
|
17
|
+
class_name = ARGV[3]
|
18
|
+
args = { class_name: class_name }
|
19
|
+
args[:mutation] = ARGV[4] if ARGV.size > 4
|
20
|
+
status = Paint["Running SOULs Generate Commands...", :yellow]
|
21
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
22
|
+
Whirly.status = status
|
23
|
+
Souls::Api::Generate.public_send(method_name, **args)
|
24
|
+
Whirly.status = "Done!"
|
25
|
+
end
|
26
|
+
when "update"
|
27
|
+
class_name = ARGV[2]
|
28
|
+
status = Paint["Running SOULs Update Commands...", :yellow]
|
29
|
+
Whirly.start(spinner: "clock", interval: 420, stop: "🎉") do
|
30
|
+
Whirly.status = status
|
31
|
+
Souls::Api::Update.create_mutation(class_name: class_name)
|
32
|
+
Souls::Api::Update.update_mutation(class_name: class_name)
|
33
|
+
Souls::Api::Update.resolver(class_name: class_name)
|
34
|
+
Souls::Api::Update.type(class_name: class_name)
|
35
|
+
Souls::Api::Update.rspec_factory(class_name: class_name)
|
36
|
+
Souls::Api::Update.rspec_mutation(class_name: class_name)
|
37
|
+
Souls::Api::Update.rspec_resolver(class_name: class_name)
|
38
|
+
Whirly.status = "Done!"
|
39
|
+
end
|
40
|
+
when "d", "delete"
|
41
|
+
class_name = ARGV[2]
|
42
|
+
Souls::Api::Generate.delete_all(class_name: class_name)
|
43
|
+
else
|
44
|
+
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
38
45
|
end
|
39
|
-
when "d", "delete"
|
40
|
-
class_name = ARGV[2]
|
41
|
-
Souls::Api::Generate.delete_all(class_name: class_name)
|
42
|
-
else
|
43
|
-
puts(Paint["Comannd doesn't exist.Check you command again!...", :red])
|
44
46
|
end
|
45
47
|
when "worker"
|
46
48
|
api_command = ARGV[1]
|
@@ -27,21 +27,6 @@ module Souls
|
|
27
27
|
]
|
28
28
|
end
|
29
29
|
|
30
|
-
def get_type_and_name(line)
|
31
|
-
line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
32
|
-
end
|
33
|
-
|
34
|
-
def get_tables
|
35
|
-
path = "./db/schema.rb"
|
36
|
-
tables = []
|
37
|
-
File.open(path, "r") do |f|
|
38
|
-
f.each_line.with_index do |line, _i|
|
39
|
-
tables << line.split("\"")[1] if line.include?("create_table")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
tables
|
43
|
-
end
|
44
|
-
|
45
30
|
def test_dir
|
46
31
|
FileUtils.mkdir_p("./app/graphql/mutations")
|
47
32
|
FileUtils.mkdir_p("./app/graphql/queries")
|
@@ -62,54 +47,6 @@ module Souls
|
|
62
47
|
puts("test dir created!")
|
63
48
|
end
|
64
49
|
|
65
|
-
def type_check(type)
|
66
|
-
{
|
67
|
-
bigint: "Integer",
|
68
|
-
string: "String",
|
69
|
-
float: "Float",
|
70
|
-
text: "String",
|
71
|
-
datetime: "String",
|
72
|
-
date: "String",
|
73
|
-
boolean: "Boolean",
|
74
|
-
integer: "Integer"
|
75
|
-
}[type.to_sym]
|
76
|
-
end
|
77
|
-
|
78
|
-
def get_type(type)
|
79
|
-
{
|
80
|
-
bigint: "Integer",
|
81
|
-
string: "String",
|
82
|
-
float: "Float",
|
83
|
-
text: "String",
|
84
|
-
datetime: "GraphQL::Types::ISO8601DateTime",
|
85
|
-
date: "GraphQL::Types::ISO8601DateTime",
|
86
|
-
boolean: "Boolean",
|
87
|
-
integer: "Integer"
|
88
|
-
}[type.to_sym]
|
89
|
-
end
|
90
|
-
|
91
|
-
def get_test_type(type)
|
92
|
-
{
|
93
|
-
bigint: "rand(1..10)",
|
94
|
-
float: 4.2,
|
95
|
-
string: '"MyString"',
|
96
|
-
text: '"MyString"',
|
97
|
-
datetime: "Time.now",
|
98
|
-
date: "Time.now.strftime('%F')",
|
99
|
-
boolean: false,
|
100
|
-
integer: "rand(1..10)"
|
101
|
-
}[type.to_sym]
|
102
|
-
end
|
103
|
-
|
104
|
-
def table_check(line: "", class_name: "")
|
105
|
-
if line.include?("create_table") && (line.split[1].gsub("\"", "").gsub(",", "") == class_name.pluralize.to_s)
|
106
|
-
|
107
|
-
return true
|
108
|
-
end
|
109
|
-
|
110
|
-
false
|
111
|
-
end
|
112
|
-
|
113
50
|
def scaffold(class_name: "user")
|
114
51
|
singularized_class_name = class_name.singularize
|
115
52
|
model(class_name: singularized_class_name)
|
@@ -133,7 +70,7 @@ module Souls
|
|
133
70
|
|
134
71
|
def scaffold_all
|
135
72
|
puts(Paint["Let's Go SOULs AUTO CRUD Assist!\n", :cyan])
|
136
|
-
Souls
|
73
|
+
Souls.get_tables.each do |table|
|
137
74
|
Souls::Api::Generate.scaffold(class_name: table.singularize)
|
138
75
|
puts(Paint["Generated #{table.camelize} CRUD Files\n", :yellow])
|
139
76
|
end
|
@@ -15,3 +15,13 @@ require_relative "./connection"
|
|
15
15
|
require_relative "./application"
|
16
16
|
require_relative "./migration"
|
17
17
|
require_relative "./manager"
|
18
|
+
|
19
|
+
# require_paths = []
|
20
|
+
# Dir["lib/souls/api/generate/*"].map do |n|
|
21
|
+
# next if n.include?("index.rb")
|
22
|
+
|
23
|
+
# require_paths << n.split("/").last.gsub(".rb", "")
|
24
|
+
# end
|
25
|
+
# require_paths.each do |path|
|
26
|
+
# require_relative "./#{path}"
|
27
|
+
# end
|
@@ -48,7 +48,7 @@ module Souls
|
|
48
48
|
end
|
49
49
|
field = "[String]" if line.include?("array: true")
|
50
50
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
51
|
-
field ||= type_check(type)
|
51
|
+
field ||= Souls.type_check(type)
|
52
52
|
case name
|
53
53
|
when "user_id"
|
54
54
|
@user_exist = true
|
@@ -61,7 +61,7 @@ module Souls
|
|
61
61
|
new_line.write(" argument :#{name}, #{field}, required: false\n")
|
62
62
|
end
|
63
63
|
end
|
64
|
-
@on = true if table_check(line: line, class_name: class_name)
|
64
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -144,7 +144,7 @@ module Souls
|
|
144
144
|
end
|
145
145
|
field = "[String]" if line.include?("array: true")
|
146
146
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
147
|
-
field ||= type_check(type)
|
147
|
+
field ||= Souls.type_check(type)
|
148
148
|
case name
|
149
149
|
when "user_id"
|
150
150
|
@user_exist = true
|
@@ -157,7 +157,7 @@ module Souls
|
|
157
157
|
new_line.write(" argument :#{name}, #{field}, required: false\n")
|
158
158
|
end
|
159
159
|
end
|
160
|
-
@on = true if table_check(line: line, class_name: class_name)
|
160
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -34,8 +34,8 @@ module Souls
|
|
34
34
|
break if line.include?("t.index") || line.strip == "end"
|
35
35
|
|
36
36
|
field = "[String]" if line.include?("array: true")
|
37
|
-
type, name = get_type_and_name(line)
|
38
|
-
field ||= type_check(type)
|
37
|
+
type, name = Souls.get_type_and_name(line)
|
38
|
+
field ||= Souls.type_check(type)
|
39
39
|
case name
|
40
40
|
when "user_id"
|
41
41
|
@user_exist = true
|
@@ -48,7 +48,7 @@ module Souls
|
|
48
48
|
new_line.write(" argument :#{name}, #{field}, required: false\n")
|
49
49
|
end
|
50
50
|
end
|
51
|
-
@on = true if table_check(line: line, class_name: class_name)
|
51
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -89,7 +89,7 @@ module Souls
|
|
89
89
|
if @on
|
90
90
|
break if line.include?("t.index") || line.strip == "end"
|
91
91
|
|
92
|
-
type, name = get_type_and_name(line)
|
92
|
+
type, name = Souls.get_type_and_name(line)
|
93
93
|
if line.include?("array: true")
|
94
94
|
new_line.write(
|
95
95
|
" scope = scope.where(\"#{name} @> ARRAY[?]::text[]\", value[:#{name}]) if value[:#{name}]\n"
|
@@ -115,7 +115,7 @@ module Souls
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
118
|
-
@on = true if table_check(line: line, class_name: class_name)
|
118
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -24,7 +24,7 @@ module Souls
|
|
24
24
|
new_line.write("\n" && break) if line.include?("t.index") || line.strip == "end"
|
25
25
|
field = '["tag1", "tag2", "tag3"]' if line.include?("array: true")
|
26
26
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
27
|
-
field ||= get_test_type(type)
|
27
|
+
field ||= Souls.get_test_type(type)
|
28
28
|
if type == "bigint" && name.include?("_id")
|
29
29
|
id_name = name.gsub("_id", "")
|
30
30
|
new_line.write(" association :#{id_name}, factory: :#{id_name}\n")
|
@@ -32,7 +32,7 @@ module Souls
|
|
32
32
|
new_line.write(" #{name} { #{field} }\n")
|
33
33
|
end
|
34
34
|
end
|
35
|
-
@on = true if table_check(line: line, class_name: class_name)
|
35
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -58,7 +58,7 @@ module Souls
|
|
58
58
|
new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
|
59
59
|
end
|
60
60
|
end
|
61
|
-
@on = true if table_check(line: line, class_name: class_name)
|
61
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -113,7 +113,7 @@ module Souls
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
116
|
-
@on = true if table_check(line: line, class_name: class_name)
|
116
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
@@ -193,7 +193,7 @@ module Souls
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
end
|
196
|
-
@on = true if table_check(line: line, class_name: class_name)
|
196
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
197
197
|
end
|
198
198
|
end
|
199
199
|
end
|
@@ -217,7 +217,7 @@ module Souls
|
|
217
217
|
break
|
218
218
|
end
|
219
219
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
220
|
-
field ||= type_check(type)
|
220
|
+
field ||= Souls.type_check(type)
|
221
221
|
array_true = line.include?("array: true")
|
222
222
|
case name
|
223
223
|
when "user_id", "created_at", "updated_at", /$*_id\z/
|
@@ -245,7 +245,7 @@ module Souls
|
|
245
245
|
end
|
246
246
|
end
|
247
247
|
end
|
248
|
-
@on = true if table_check(line: line, class_name: class_name)
|
248
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
@@ -56,7 +56,7 @@ module Souls
|
|
56
56
|
new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
|
57
57
|
end
|
58
58
|
end
|
59
|
-
@on = true if table_check(line: line, class_name: class_name)
|
59
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -101,7 +101,7 @@ module Souls
|
|
101
101
|
new_line.write(" #{name.camelize(:lower)}\n")
|
102
102
|
end
|
103
103
|
end
|
104
|
-
@on = true if table_check(line: line, class_name: class_name)
|
104
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -125,7 +125,7 @@ module Souls
|
|
125
125
|
break
|
126
126
|
end
|
127
127
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
128
|
-
field ||= type_check(type)
|
128
|
+
field ||= Souls.type_check(type)
|
129
129
|
array_true = line.include?("array: true")
|
130
130
|
case name
|
131
131
|
when "user_id", "created_at", "updated_at", /$*_id\z/
|
@@ -145,7 +145,7 @@ module Souls
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
|
-
@on = true if table_check(line: line, class_name: class_name)
|
148
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
@@ -64,7 +64,7 @@ module Souls
|
|
64
64
|
new_line.write(" let(:#{relation_col}) { FactoryBot.create(:#{relation_col}) }\n")
|
65
65
|
end
|
66
66
|
end
|
67
|
-
@on = true if table_check(line: line, class_name: class_name)
|
67
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -120,7 +120,7 @@ module Souls
|
|
120
120
|
new_line.write(" #{name.camelize(:lower)}\n")
|
121
121
|
end
|
122
122
|
end
|
123
|
-
@on = true if table_check(line: line, class_name: class_name)
|
123
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
@@ -144,7 +144,7 @@ module Souls
|
|
144
144
|
break
|
145
145
|
end
|
146
146
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
147
|
-
field ||= type_check(type)
|
147
|
+
field ||= Souls.type_check(type)
|
148
148
|
array_true = line.include?("array: true")
|
149
149
|
case name
|
150
150
|
when "user_id", "created_at", "updated_at", /$*_id\z/
|
@@ -172,7 +172,7 @@ module Souls
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
end
|
175
|
-
@on = true if table_check(line: line, class_name: class_name)
|
175
|
+
@on = true if Souls.table_check(line: line, class_name: class_name)
|
176
176
|
end
|
177
177
|
end
|
178
178
|
end
|
@@ -27,7 +27,7 @@ module Souls
|
|
27
27
|
new_line.write("\n" && break) if line.include?("t.index") || line.strip == "end"
|
28
28
|
field = "[String]" if line.include?("array: true")
|
29
29
|
type, name = line.split(",")[0].gsub("\"", "").scan(/((?<=t\.).+(?=\s)) (.+)/)[0]
|
30
|
-
field ||= type_check(type)
|
30
|
+
field ||= Souls.type_check(type)
|
31
31
|
case name
|
32
32
|
when /$*_id\z/
|
33
33
|
new_line.write(
|
@@ -43,7 +43,7 @@ module Souls
|
|
43
43
|
new_line.write(" field :#{name}, #{field}, null: true\n")
|
44
44
|
end
|
45
45
|
end
|
46
|
-
if table_check(line: line, class_name: class_name)
|
46
|
+
if Souls.table_check(line: line, class_name: class_name)
|
47
47
|
@on = true
|
48
48
|
new_line.write(" global_id_field :id\n")
|
49
49
|
end
|
@@ -16,7 +16,7 @@ module Souls
|
|
16
16
|
next unless line.include?("argument") && !argument
|
17
17
|
|
18
18
|
new_cols.each do |col|
|
19
|
-
type = Souls
|
19
|
+
type = Souls.type_check(col[:type])
|
20
20
|
type = "[#{type}]" if col[:array]
|
21
21
|
args = check_mutation_argument(class_name: class_name)
|
22
22
|
next if args.include?(col[:column_name])
|
@@ -47,7 +47,7 @@ module Souls
|
|
47
47
|
next unless line.include?("argument") && !argument
|
48
48
|
|
49
49
|
new_cols.each do |col|
|
50
|
-
type = Souls
|
50
|
+
type = Souls.type_check(col[:type])
|
51
51
|
type = "[#{type}]" if col[:array]
|
52
52
|
args = check_mutation_argument(class_name: class_name, action: "update")
|
53
53
|
next if args.include?(col[:column_name])
|
@@ -18,7 +18,7 @@ module Souls
|
|
18
18
|
new_line.write(line)
|
19
19
|
if line.include?("argument") && !argument
|
20
20
|
new_cols.each do |col|
|
21
|
-
type = Souls
|
21
|
+
type = Souls.type_check(col[:type])
|
22
22
|
type = "[#{type}]" if col[:array]
|
23
23
|
add_line = " argument :#{col[:column_name]}, #{type}, required: false\n"
|
24
24
|
new_line.write(add_line) unless args.include?(col[:column_name])
|
@@ -26,7 +26,7 @@ module Souls
|
|
26
26
|
argument = true
|
27
27
|
elsif line.include?("scope = ::") && !scope
|
28
28
|
new_cols.each do |col|
|
29
|
-
type = Souls
|
29
|
+
type = Souls.type_check(col[:type])
|
30
30
|
type = "[#{type}]" if col[:array]
|
31
31
|
|
32
32
|
if type.include?("[")
|
@@ -19,7 +19,7 @@ module Souls
|
|
19
19
|
new_cols.each do |col|
|
20
20
|
next if col[:column_name] == "created_at" || col[:column_name] == "updated_at"
|
21
21
|
|
22
|
-
type = Souls
|
22
|
+
type = Souls.get_test_type(col[:type])
|
23
23
|
type = "[#{type}]" if col[:array]
|
24
24
|
args = check_factory_argument(class_name: class_name)
|
25
25
|
|