souls 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +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: 604dd7ee9586360aff67c1dc45aabcf0e9d66038d280aae8abb829af7856932a
|
4
|
+
data.tar.gz: 6d405c4bfa0def7d24e10290cf1e412f860849b142eb9515892f84c26ae22dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f6f0b54ce0703d05cc654cb91907ad9ac9e74a2380de623d3b3db38982784faf45652b96f77866778a312af94443fc427f85452a4b2392cae146efa69475126
|
7
|
+
data.tar.gz: 0fdba239a2f5f94e4990013207aa55c246f4dcf2457d03305e6f7f22ebe1f258cd2a142508391cf1365c6db42c0e80a7b052c0ba47b15595b22102e23b58bf1b
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.2
|
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.2
|
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.2
|
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.2
|
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
|