souls 1.7.1 → 1.7.5
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/delete/application.rb +0 -4
- data/lib/souls/cli/generate/application.rb +0 -26
- data/lib/souls/cli/generate/rspec_job.rb +2 -2
- 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 +0 -2
- metadata +3 -9
- data/lib/souls/cli/delete/policy.rb +0 -15
- data/lib/souls/cli/delete/policy_rbs.rb +0 -19
- data/lib/souls/cli/delete/rspec_policy.rb +0 -14
- data/lib/souls/cli/generate/policy.rb +0 -51
- data/lib/souls/cli/generate/policy_rbs.rb +0 -35
- data/lib/souls/cli/generate/rspec_policy.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d89f149b6ed7303f89fb3e269b599458b03632ef231ea4e5e16f759b89b20ac
|
4
|
+
data.tar.gz: fd0db8f94f5e15ff8530e620c99b2a58f0b1be080a5fe63656defb7314af9b61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee48301b8981aa979ba83b87365e1a5c16486314b15b3908fb04e27ffede40ace96790b98085099df00a1aed8576e0b39761970e201a629e7ffadc27869a83d6
|
7
|
+
data.tar.gz: 9cabccc639b40edeb0f2d65af212cc3fcd4185bf07d78f87bdb7dfad4bc6433c493ca097faee81f8fcf4a80904650074f94af21fe0f2a2c8e9b538932e8c387a
|
@@ -39,8 +39,6 @@ module Souls
|
|
39
39
|
query_rbs(class_name)
|
40
40
|
mutation(class_name)
|
41
41
|
mutation_rbs(class_name)
|
42
|
-
policy(class_name)
|
43
|
-
policy_rbs(class_name)
|
44
42
|
edge(class_name)
|
45
43
|
edge_rbs(class_name)
|
46
44
|
connection(class_name)
|
@@ -51,14 +49,12 @@ module Souls
|
|
51
49
|
rspec_mutation(class_name)
|
52
50
|
rspec_query(class_name)
|
53
51
|
rspec_resolver(class_name)
|
54
|
-
rspec_policy(class_name)
|
55
52
|
end
|
56
53
|
|
57
54
|
def run_rbs_scaffold(class_name: "user")
|
58
55
|
type_rbs(class_name)
|
59
56
|
query_rbs(class_name)
|
60
57
|
mutation_rbs(class_name)
|
61
|
-
policy_rbs(class_name)
|
62
58
|
edge_rbs(class_name)
|
63
59
|
connection_rbs(class_name)
|
64
60
|
resolver_rbs(class_name)
|
@@ -39,8 +39,6 @@ module Souls
|
|
39
39
|
query_rbs(class_name)
|
40
40
|
mutation(class_name)
|
41
41
|
mutation_rbs(class_name)
|
42
|
-
policy(class_name)
|
43
|
-
policy_rbs(class_name)
|
44
42
|
edge(class_name)
|
45
43
|
edge_rbs(class_name)
|
46
44
|
connection(class_name)
|
@@ -51,14 +49,12 @@ module Souls
|
|
51
49
|
rspec_mutation(class_name)
|
52
50
|
rspec_query(class_name)
|
53
51
|
rspec_resolver(class_name)
|
54
|
-
rspec_policy(class_name)
|
55
52
|
end
|
56
53
|
|
57
54
|
def run_rbs_scaffold(class_name)
|
58
55
|
type_rbs(class_name)
|
59
56
|
query_rbs(class_name)
|
60
57
|
mutation_rbs(class_name)
|
61
|
-
policy_rbs(class_name)
|
62
58
|
edge_rbs(class_name)
|
63
59
|
connection_rbs(class_name)
|
64
60
|
resolver_rbs(class_name)
|
@@ -69,7 +65,6 @@ module Souls
|
|
69
65
|
pluralized_class_name = class_name.pluralize.underscore
|
70
66
|
[
|
71
67
|
"./app/models/#{singularized_class_name}.rb",
|
72
|
-
"./app/policies/#{singularized_class_name}_policy.rb",
|
73
68
|
"./app/graphql/mutations/create_#{singularized_class_name}.rb",
|
74
69
|
"./app/graphql/mutations/delete_#{singularized_class_name}.rb",
|
75
70
|
"./app/graphql/mutations/destroy_delete_#{singularized_class_name}.rb",
|
@@ -84,29 +79,8 @@ module Souls
|
|
84
79
|
"./spec/mutations/#{singularized_class_name}_spec.rb",
|
85
80
|
"./spec/models/#{singularized_class_name}_spec.rb",
|
86
81
|
"./spec/queries/#{singularized_class_name}_spec.rb",
|
87
|
-
"./spec/policies/#{singularized_class_name}_policy_spec.rb",
|
88
82
|
"./spec/resolvers/#{singularized_class_name}_search_spec.rb"
|
89
83
|
]
|
90
84
|
end
|
91
|
-
|
92
|
-
def test_dir
|
93
|
-
FileUtils.mkdir_p("./app/graphql/mutations")
|
94
|
-
FileUtils.mkdir_p("./app/graphql/queries")
|
95
|
-
FileUtils.mkdir_p("./app/graphql/types")
|
96
|
-
FileUtils.mkdir_p("./app/graphql/resolvers")
|
97
|
-
FileUtils.mkdir_p("./app/models")
|
98
|
-
FileUtils.mkdir_p("./app/policies")
|
99
|
-
FileUtils.mkdir_p("./spec/factories")
|
100
|
-
FileUtils.mkdir_p("./spec/queries")
|
101
|
-
FileUtils.mkdir_p("./spec/mutations")
|
102
|
-
FileUtils.mkdir_p("./spec/models")
|
103
|
-
FileUtils.mkdir_p("./spec/resolvers")
|
104
|
-
FileUtils.mkdir_p("./spec/policies")
|
105
|
-
FileUtils.mkdir_p("./config")
|
106
|
-
FileUtils.touch("./config/souls.rb")
|
107
|
-
FileUtils.mkdir_p("./db/")
|
108
|
-
FileUtils.touch("./db/schema.rb")
|
109
|
-
puts("test dir created!")
|
110
|
-
end
|
111
85
|
end
|
112
86
|
end
|
@@ -25,13 +25,13 @@ module Souls
|
|
25
25
|
end
|
26
26
|
|
27
27
|
subject(:result) do
|
28
|
-
SoulsApiSchema.execute(
|
28
|
+
SoulsApiSchema.execute(query).as_json
|
29
29
|
end
|
30
30
|
|
31
31
|
it "return #{singularized_class_name.camelize} response" do
|
32
32
|
stub_request(:post, "https://api.mailgun.net/v3/YOUR-MAILGUN-DOMAIN/messages")
|
33
33
|
.to_return(status: 200, body: "", headers: {})
|
34
|
-
|
34
|
+
#{' '}
|
35
35
|
a1 = result.dig("data", "#{singularized_class_name.camelize(:lower)}")
|
36
36
|
expect(a1).not_to be_empty
|
37
37
|
expect(a1).to(include("response" => be_a(String)))
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.5
|
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.5
|
data/lib/souls.rb
CHANGED
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.7.
|
4
|
+
version: 1.7.5
|
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-11-
|
13
|
+
date: 2021-11-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -147,8 +147,6 @@ files:
|
|
147
147
|
- lib/souls/cli/delete/manager_rbs.rb
|
148
148
|
- lib/souls/cli/delete/mutation.rb
|
149
149
|
- lib/souls/cli/delete/mutation_rbs.rb
|
150
|
-
- lib/souls/cli/delete/policy.rb
|
151
|
-
- lib/souls/cli/delete/policy_rbs.rb
|
152
150
|
- lib/souls/cli/delete/query.rb
|
153
151
|
- lib/souls/cli/delete/query_rbs.rb
|
154
152
|
- lib/souls/cli/delete/resolver.rb
|
@@ -157,7 +155,6 @@ files:
|
|
157
155
|
- lib/souls/cli/delete/rspec_job.rb
|
158
156
|
- lib/souls/cli/delete/rspec_manager.rb
|
159
157
|
- lib/souls/cli/delete/rspec_mutation.rb
|
160
|
-
- lib/souls/cli/delete/rspec_policy.rb
|
161
158
|
- lib/souls/cli/delete/rspec_query.rb
|
162
159
|
- lib/souls/cli/delete/rspec_resolver.rb
|
163
160
|
- lib/souls/cli/delete/type.rb
|
@@ -183,8 +180,6 @@ files:
|
|
183
180
|
- lib/souls/cli/generate/manager_rbs.rb
|
184
181
|
- lib/souls/cli/generate/mutation.rb
|
185
182
|
- lib/souls/cli/generate/mutation_rbs.rb
|
186
|
-
- lib/souls/cli/generate/policy.rb
|
187
|
-
- lib/souls/cli/generate/policy_rbs.rb
|
188
183
|
- lib/souls/cli/generate/query.rb
|
189
184
|
- lib/souls/cli/generate/query_rbs.rb
|
190
185
|
- lib/souls/cli/generate/resolver.rb
|
@@ -193,7 +188,6 @@ files:
|
|
193
188
|
- lib/souls/cli/generate/rspec_job.rb
|
194
189
|
- lib/souls/cli/generate/rspec_manager.rb
|
195
190
|
- lib/souls/cli/generate/rspec_mutation.rb
|
196
|
-
- lib/souls/cli/generate/rspec_policy.rb
|
197
191
|
- lib/souls/cli/generate/rspec_query.rb
|
198
192
|
- lib/souls/cli/generate/rspec_resolver.rb
|
199
193
|
- lib/souls/cli/generate/type.rb
|
@@ -232,7 +226,7 @@ licenses:
|
|
232
226
|
metadata:
|
233
227
|
homepage_uri: https://souls.elsoul.nl
|
234
228
|
source_code_uri: https://github.com/elsoul/souls
|
235
|
-
changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.7.
|
229
|
+
changelog_uri: https://github.com/elsoul/souls/releases/tag/v1.7.5
|
236
230
|
post_install_message:
|
237
231
|
rdoc_options: []
|
238
232
|
require_paths:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Souls
|
2
|
-
class Delete < Thor
|
3
|
-
desc "policy [CLASS_NAME]", "Delete Policy File Template"
|
4
|
-
def policy(class_name)
|
5
|
-
dir_name = "./app/policies"
|
6
|
-
FileUtils.mkdir_p(dir_name) unless Dir.exist?(dir_name)
|
7
|
-
file_path = "#{dir_name}/#{class_name.singularize}_policy.rb"
|
8
|
-
FileUtils.rm(file_path)
|
9
|
-
puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
|
10
|
-
file_path
|
11
|
-
rescue Thor::Error => e
|
12
|
-
raise(Thor::Error, e)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Souls
|
2
|
-
class Delete < Thor
|
3
|
-
desc "policy_rbs [CLASS_NAME]", "Delete Policy RBS"
|
4
|
-
def policy_rbs(class_name)
|
5
|
-
file_path = ""
|
6
|
-
Dir.chdir(Souls.get_mother_path.to_s) do
|
7
|
-
file_dir = "./sig/api/app/graphql/policies/"
|
8
|
-
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
9
|
-
singularized_class_name = class_name.underscore.singularize
|
10
|
-
file_path = "#{file_dir}#{singularized_class_name}_policy.rbs"
|
11
|
-
FileUtils.rm(file_path)
|
12
|
-
puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
|
13
|
-
end
|
14
|
-
file_path
|
15
|
-
rescue Thor::Error => e
|
16
|
-
raise(Thor::Error, e)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Souls
|
2
|
-
class Delete < Thor
|
3
|
-
desc "rspec_policy [CLASS_NAME]", "Delete Rspec Policy Test"
|
4
|
-
def rspec_policy(class_name)
|
5
|
-
singularized_class_name = class_name.singularize
|
6
|
-
file_path = "./spec/policies/#{singularized_class_name}_policy_spec.rb"
|
7
|
-
FileUtils.rm(file_path)
|
8
|
-
puts(Paint % ["Deleted file! : %{white_text}", :yellow, { white_text: [file_path.to_s, :white] }])
|
9
|
-
file_path
|
10
|
-
rescue Thor::Error => e
|
11
|
-
raise(Thor::Error, e)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Souls
|
2
|
-
class Generate < Thor
|
3
|
-
desc "policy [CLASS_NAME]", "Generate Policy File Template"
|
4
|
-
def policy(class_name)
|
5
|
-
dir_name = "./app/policies"
|
6
|
-
FileUtils.mkdir_p(dir_name) unless Dir.exist?(dir_name)
|
7
|
-
file_path = "#{dir_name}/#{class_name.singularize}_policy.rb"
|
8
|
-
return "Policy already exist! #{file_path}" if File.exist?(file_path)
|
9
|
-
|
10
|
-
File.open(file_path, "w") do |f|
|
11
|
-
f.write(<<~TEXT)
|
12
|
-
class #{class_name.camelize}Policy < ApplicationPolicy
|
13
|
-
def show?
|
14
|
-
true
|
15
|
-
end
|
16
|
-
|
17
|
-
def index?
|
18
|
-
true
|
19
|
-
end
|
20
|
-
|
21
|
-
def create?
|
22
|
-
user_permissions?
|
23
|
-
end
|
24
|
-
|
25
|
-
def update?
|
26
|
-
user_permissions?
|
27
|
-
end
|
28
|
-
|
29
|
-
def delete?
|
30
|
-
admin_permissions?
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def user_permissions?
|
36
|
-
@user.master? or @user.admin? or @user.user?
|
37
|
-
end
|
38
|
-
|
39
|
-
def admin_permissions?
|
40
|
-
@user.master? or @user.admin?
|
41
|
-
end
|
42
|
-
end
|
43
|
-
TEXT
|
44
|
-
end
|
45
|
-
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
46
|
-
file_path
|
47
|
-
rescue Thor::Error => e
|
48
|
-
raise(Thor::Error, e)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Souls
|
2
|
-
class Generate < Thor
|
3
|
-
desc "policy_rbs [CLASS_NAME]", "Generate Policy RBS"
|
4
|
-
def policy_rbs(class_name)
|
5
|
-
file_path = ""
|
6
|
-
Dir.chdir(Souls.get_mother_path.to_s) do
|
7
|
-
file_dir = "./sig/api/app/graphql/policies/"
|
8
|
-
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
9
|
-
singularized_class_name = class_name.underscore.singularize
|
10
|
-
file_path = "#{file_dir}#{singularized_class_name}_policy.rbs"
|
11
|
-
File.open(file_path, "w") do |f|
|
12
|
-
f.write(<<~TEXT)
|
13
|
-
class #{singularized_class_name.camelize}Policy
|
14
|
-
@user: untyped
|
15
|
-
|
16
|
-
def show?: -> true
|
17
|
-
def index?: -> true
|
18
|
-
def create?: -> bool
|
19
|
-
def update?: -> bool
|
20
|
-
def delete?: -> bool
|
21
|
-
|
22
|
-
private
|
23
|
-
def user_permissions?: -> untyped
|
24
|
-
def admin_permissions?: -> untyped
|
25
|
-
end
|
26
|
-
TEXT
|
27
|
-
end
|
28
|
-
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
29
|
-
end
|
30
|
-
file_path
|
31
|
-
rescue Thor::Error => e
|
32
|
-
raise(Thor::Error, e)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Souls
|
2
|
-
class Generate < Thor
|
3
|
-
desc "rspec_policy [CLASS_NAME]", "Generate Rspec Policy Test from schema.rb"
|
4
|
-
def rspec_policy(class_name)
|
5
|
-
dir_name = "./spec/policies"
|
6
|
-
FileUtils.mkdir_p(dir_name) unless Dir.exist?(dir_name)
|
7
|
-
file_path = "./spec/policies/#{class_name}_policy_spec.rb"
|
8
|
-
return "RspecPolicy already exist! #{file_path}" if File.exist?(file_path)
|
9
|
-
|
10
|
-
File.open(file_path, "w") do |new_line|
|
11
|
-
new_line.write(<<~TEXT)
|
12
|
-
describe #{class_name.camelize}Policy do
|
13
|
-
subject { described_class.new(user, #{class_name.underscore}) }
|
14
|
-
|
15
|
-
let(:#{class_name.underscore}) { FactoryBot.create(:#{class_name.underscore}) }
|
16
|
-
|
17
|
-
context "being a visitor" do
|
18
|
-
let(:user) { FactoryBot.create(:user, roles: :normal) }
|
19
|
-
|
20
|
-
it { is_expected.to permit_action(:index) }
|
21
|
-
it { is_expected.to permit_action(:show) }
|
22
|
-
it { is_expected.to forbid_actions([:create, :update, :delete]) }
|
23
|
-
end
|
24
|
-
|
25
|
-
context "being a user" do
|
26
|
-
let(:user) { FactoryBot.create(:user, roles: :user) }
|
27
|
-
|
28
|
-
it { is_expected.to permit_actions([:create, :update]) }
|
29
|
-
end
|
30
|
-
|
31
|
-
context "being an admin" do
|
32
|
-
let(:user) { FactoryBot.create(:user, roles: :admin) }
|
33
|
-
|
34
|
-
it { is_expected.to permit_actions([:create, :update, :delete]) }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
TEXT
|
38
|
-
end
|
39
|
-
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
40
|
-
file_path
|
41
|
-
rescue Thor::Error => e
|
42
|
-
raise(Thor::Error, e)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|