souls 0.25.13 → 0.25.17
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 +1 -1
- data/lib/souls.rb +26 -0
- data/lib/souls/generate/mutation.rb +3 -3
- data/lib/souls/generate/rspec_policy.rb +3 -3
- data/lib/souls/generate/rspec_query.rb +35 -35
- data/lib/souls/generate/rspec_resolver.rb +44 -44
- 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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ac34b77f043d519782fcc96186b2a367e698f6c54942ca57f7e433feb79de7
|
4
|
+
data.tar.gz: 9bd6a7050e1e21b3a3af3f65fe79a8f48a82351433c243ece6741209db07c176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e4c57899b2e1e4c253a7e8069ab0c040f0e5570db12d12540b698ff6f93734d73ecced5268c93122217e624cf9621360281985856e8965e95bdffcd414370cd
|
7
|
+
data.tar.gz: aba9a8c9f85fdfef566aba952dd093c17b5798fd76e93ab89b71421ca237b1859122c1c41b1168802a742279e4f2d794c8b7d3156efd317568be4ae7874a8af5
|
data/exe/souls
CHANGED
@@ -184,7 +184,7 @@ begin
|
|
184
184
|
system("rm -rf ../#{other_app}/db/*")
|
185
185
|
system("cp -r ./db/* ../#{other_app}/db/*")
|
186
186
|
when "t", "test"
|
187
|
-
system("rubocop -
|
187
|
+
system("rubocop -A")
|
188
188
|
system("bundle exec rspec")
|
189
189
|
when "run"
|
190
190
|
system("docker build . -t souls -f Dockerfile.dev")
|
data/lib/souls.rb
CHANGED
@@ -174,6 +174,7 @@ module Souls
|
|
174
174
|
bucket_url = "gs://souls-bucket/boilerplates"
|
175
175
|
file_name = "#{service_name}-v#{new_ver}.tgz"
|
176
176
|
release_name = "#{service_name}-latest.tgz"
|
177
|
+
update_service_gemfile(service_name: service_name)
|
177
178
|
|
178
179
|
case current_dir_name
|
179
180
|
when "souls"
|
@@ -256,6 +257,31 @@ module Souls
|
|
256
257
|
end
|
257
258
|
end
|
258
259
|
|
260
|
+
def update_service_gemfile(service_name: "api")
|
261
|
+
file_dir = "./apps/#{service_name}"
|
262
|
+
file_path = "#{file_dir}/Gemfile"
|
263
|
+
gemfile_lock = "#{file_dir}/Gemfile.lock"
|
264
|
+
tmp_file = "#{file_dir}/tmp/Gemfile"
|
265
|
+
File.open(file_path, "r") do |f|
|
266
|
+
File.open(tmp_file, "w") do |new_line|
|
267
|
+
f.each_line do |line|
|
268
|
+
gem = line.gsub("gem ", "").gsub("\"", "").gsub("\n", "").gsub(" ", "").split(",")
|
269
|
+
if gem[0] == "souls"
|
270
|
+
old_ver = gem[1].split(".")
|
271
|
+
old_ver[2] = (old_ver[2].to_i + 1).to_s
|
272
|
+
new_line.write(" gem \"souls\", \"#{old_ver.join('.')}\"\n")
|
273
|
+
else
|
274
|
+
new_line.write(line)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
FileUtils.rm(file_path)
|
280
|
+
FileUtils.rm(gemfile_lock) if File.exist?(gemfile_lock)
|
281
|
+
FileUtils.mv(tmp_file, file_path)
|
282
|
+
puts(Paint["\nSuccessfully Updated #{service_name} Gemfile!", :green])
|
283
|
+
end
|
284
|
+
|
259
285
|
def detect_change
|
260
286
|
git_status = `git status`
|
261
287
|
result =
|
@@ -10,9 +10,9 @@ module Souls
|
|
10
10
|
File.open(file_path, "w") do |new_line|
|
11
11
|
new_line.write(<<~TEXT)
|
12
12
|
module Mutations
|
13
|
-
module
|
13
|
+
module Base::#{singularized_class_name.camelize}
|
14
14
|
class Create#{singularized_class_name.camelize} < BaseMutation
|
15
|
-
field :#{singularized_class_name}_edge, Types::#{singularized_class_name.camelize}.edge_type, null: false
|
15
|
+
field :#{singularized_class_name}_edge, Types::#{singularized_class_name.camelize}Type.edge_type, null: false
|
16
16
|
field :error, String, null: true
|
17
17
|
|
18
18
|
TEXT
|
@@ -106,7 +106,7 @@ module Souls
|
|
106
106
|
module Mutations
|
107
107
|
module #{class_name.camelize}
|
108
108
|
class Update#{class_name.camelize} < BaseMutation
|
109
|
-
field :#{class_name}_edge, Types::#{class_name.camelize}.edge_type, null: false
|
109
|
+
field :#{class_name}_edge, Types::#{class_name.camelize}Type.edge_type, null: false
|
110
110
|
|
111
111
|
argument :id, String, required: true
|
112
112
|
TEXT
|
@@ -15,7 +15,7 @@ module Souls
|
|
15
15
|
let(:#{class_name.underscore}) { FactoryBot.create(:#{class_name.underscore}) }
|
16
16
|
|
17
17
|
context "being a visitor" do
|
18
|
-
let(:user) { FactoryBot.create(:user,
|
18
|
+
let(:user) { FactoryBot.create(:user, roles: :normal) }
|
19
19
|
|
20
20
|
it { is_expected.to permit_action(:index) }
|
21
21
|
it { is_expected.to permit_action(:show) }
|
@@ -23,13 +23,13 @@ module Souls
|
|
23
23
|
end
|
24
24
|
|
25
25
|
context "being a user" do
|
26
|
-
let(:user) { FactoryBot.create(:user,
|
26
|
+
let(:user) { FactoryBot.create(:user, roles: :user) }
|
27
27
|
|
28
28
|
it { is_expected.to permit_actions([:create, :update]) }
|
29
29
|
end
|
30
30
|
|
31
31
|
context "being an admin" do
|
32
|
-
let(:user) { FactoryBot.create(:user,
|
32
|
+
let(:user) { FactoryBot.create(:user, roles: :admin) }
|
33
33
|
|
34
34
|
it { is_expected.to permit_actions([:create, :update, :delete]) }
|
35
35
|
end
|
@@ -26,23 +26,23 @@ module Souls
|
|
26
26
|
if line.include?("end") || line.include?("t.index")
|
27
27
|
if @relation_params.empty?
|
28
28
|
new_line.write(<<-TEXT)
|
29
|
-
|
29
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
let(:query) do
|
32
|
+
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
33
|
+
%(query {
|
34
|
+
#{class_name.singularize.camelize(:lower)}(id: \\"\#{data_id}\\") {
|
35
|
+
id
|
36
36
|
TEXT
|
37
37
|
else
|
38
38
|
new_line.write(<<-TEXT)
|
39
|
-
|
39
|
+
let(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(', ')}) }
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
let(:query) do
|
42
|
+
data_id = Base64.encode64("#{class_name.camelize}:\#{#{class_name.singularize.underscore}.id}")
|
43
|
+
%(query {
|
44
|
+
#{class_name.singularize.camelize(:lower)}(id: \\"\#{data_id}\\") {
|
45
|
+
id
|
46
46
|
TEXT
|
47
47
|
end
|
48
48
|
break
|
@@ -70,25 +70,25 @@ module Souls
|
|
70
70
|
f.each_line.with_index do |line, _i|
|
71
71
|
if @on
|
72
72
|
if line.include?("end") || line.include?("t.index")
|
73
|
-
new_line.write(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
73
|
+
new_line.write(<<-TEXT)
|
74
|
+
}
|
75
|
+
}
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
subject(:result) do
|
80
|
+
SoulsApiSchema.execute(query).as_json
|
81
|
+
end
|
82
|
+
|
83
|
+
it "return #{class_name.camelize} Data" do
|
84
|
+
begin
|
85
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}")
|
86
|
+
raise unless a1.present?
|
87
|
+
rescue
|
88
|
+
raise StandardError, result
|
89
|
+
end
|
90
|
+
expect(a1).to include(
|
91
|
+
"id" => be_a(String),
|
92
92
|
TEXT
|
93
93
|
break
|
94
94
|
end
|
@@ -133,14 +133,14 @@ module Souls
|
|
133
133
|
case type
|
134
134
|
when "text", "date", "datetime"
|
135
135
|
if array_true
|
136
|
-
new_line.write("
|
136
|
+
new_line.write(" \"#{name.camelize(:lower)}\" => be_all(String),\n")
|
137
137
|
else
|
138
|
-
new_line.write("
|
138
|
+
new_line.write(" \"#{name.camelize(:lower)}\" => be_a(String),\n")
|
139
139
|
end
|
140
140
|
when "boolean"
|
141
|
-
new_line.write("
|
141
|
+
new_line.write(" \"#{name.singularize.camelize(:lower)}\" => be_in([true, false]),\n")
|
142
142
|
when "string", "bigint", "integer", "float"
|
143
|
-
new_line.write("
|
143
|
+
new_line.write(" \"#{name.singularize.camelize(:lower)}\" => be_a(#{field}),\n")
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
@@ -26,31 +26,31 @@ module Souls
|
|
26
26
|
if line.include?("end") || line.include?("t.index")
|
27
27
|
if @relation_params.empty?
|
28
28
|
new_line.write(<<-TEXT)
|
29
|
-
|
29
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}) }
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
let(:query) do
|
32
|
+
%(query {
|
33
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
34
|
+
isDeleted: false
|
35
|
+
}) {
|
36
|
+
edges {
|
37
|
+
cursor
|
38
|
+
node {
|
39
|
+
id
|
40
40
|
TEXT
|
41
41
|
else
|
42
42
|
new_line.write(<<-TEXT)
|
43
|
-
|
43
|
+
let!(:#{class_name}) { FactoryBot.create(:#{class_name}, #{@relation_params.join(', ')}) }
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
let(:query) do
|
46
|
+
%(query {
|
47
|
+
#{class_name.singularize.camelize(:lower)}Search(filter: {
|
48
|
+
isDeleted: false
|
49
|
+
}) {
|
50
|
+
edges {
|
51
|
+
cursor
|
52
|
+
node {
|
53
|
+
id
|
54
54
|
TEXT
|
55
55
|
end
|
56
56
|
break
|
@@ -79,35 +79,35 @@ module Souls
|
|
79
79
|
if @on
|
80
80
|
if line.include?("end") || line.include?("t.index")
|
81
81
|
new_line.write(<<-TEXT)
|
82
|
+
}
|
83
|
+
}
|
84
|
+
nodes {
|
85
|
+
id
|
86
|
+
}
|
87
|
+
pageInfo {
|
88
|
+
endCursor
|
89
|
+
hasNextPage
|
90
|
+
startCursor
|
91
|
+
hasPreviousPage
|
82
92
|
}
|
83
|
-
}
|
84
|
-
nodes {
|
85
|
-
id
|
86
|
-
}
|
87
|
-
pageInfo {
|
88
|
-
endCursor
|
89
|
-
hasNextPage
|
90
|
-
startCursor
|
91
|
-
hasPreviousPage
|
92
93
|
}
|
93
94
|
}
|
94
|
-
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
subject(:result) do
|
99
|
-
SoulsApiSchema.execute(query).as_json
|
100
|
-
end
|
95
|
+
)
|
96
|
+
end
|
101
97
|
|
102
|
-
|
103
|
-
|
104
|
-
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
|
105
|
-
raise unless a1.present?
|
106
|
-
rescue
|
107
|
-
raise StandardError, result
|
98
|
+
subject(:result) do
|
99
|
+
SoulsApiSchema.execute(query).as_json
|
108
100
|
end
|
109
|
-
|
110
|
-
|
101
|
+
|
102
|
+
it "return #{class_name.camelize} Data" do
|
103
|
+
begin
|
104
|
+
a1 = result.dig("data", "#{class_name.singularize.camelize(:lower)}Search", "edges")[0]["node"]
|
105
|
+
raise unless a1.present?
|
106
|
+
rescue
|
107
|
+
raise StandardError, result
|
108
|
+
end
|
109
|
+
expect(a1).to include(
|
110
|
+
"id" => be_a(String),
|
111
111
|
TEXT
|
112
112
|
break
|
113
113
|
end
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.20
|
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.20
|