souls 0.17.3 → 0.17.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e0e45cd92b7c2d7ffd54a5e49350615d0413a99ad49fa6f1312019184186979
4
- data.tar.gz: b0677d2efb8da005c391dd97f9cf9d507f27a6020bbede62988630d8718e474b
3
+ metadata.gz: 3d75356f72b972890fc8381fc9b0bafeb5785fb8d6dcc7a6d7e20b4c2e6bba27
4
+ data.tar.gz: 2f91cc0387b40bb24f2cbc4ce95d9c8c60c51f32683472957b56d69ee942b111
5
5
  SHA512:
6
- metadata.gz: 6ef658d2adcb3fa24e176e6598d65a847c220ef4893023d9a61898aadd78b33b1d3155d80d70b87b2e864e0727d01dd19b085065ae453fe87a82e92c6744b675
7
- data.tar.gz: 32543be68ca4e7e30e744f05e26f63bec32bfe6f6f5094f708dc88d484ddb3f3b061782bd06c6bbe7893a188cb492ddf3e0117c28a4be2f365eb10a731110a18
6
+ metadata.gz: f77af6d106b7d7fe8ea44d79902712e8f4121b98f3a15dff038fda23d54f518866485be26d8ff3455786386bd7cab4c47b0ffcf5825764656b660dc754f9f79d
7
+ data.tar.gz: dfc7a4779c8fc36341a56dc52facc8ad3c5274575aa176270d32d76d78e598552178ce4c5c17e90bd2f69b08860468f33639c07f4de0140ea5545b71b556e950
data/exe/souls CHANGED
@@ -67,6 +67,8 @@ begin
67
67
  case ARGV[1]
68
68
  when "test_dir"
69
69
  Souls::Init.test_dir
70
+ when "policy"
71
+ Souls::Init.policy class_name: ARGV[2]
70
72
  when "node_type"
71
73
  Souls::Init.node_type class_name: ARGV[2]
72
74
  when "resolver"
@@ -19,6 +19,46 @@ module Souls
19
19
  [file_path]
20
20
  end
21
21
 
22
+ def policy class_name: "souls"
23
+ file_path = "./app/policy/#{class_name.singularize}_policy.rb"
24
+ File.open(file_path, "w") do |f|
25
+ f.write <<~EOS
26
+ class #{class_name.camelize}Policy < ApplicationPolicy
27
+ def show?
28
+ true
29
+ end
30
+
31
+ def index?
32
+ true
33
+ end
34
+
35
+ def create?
36
+ staff_permissions?
37
+ end
38
+
39
+ def update?
40
+ staff_permissions?
41
+ end
42
+
43
+ def delete?
44
+ staff_permissions?
45
+ end
46
+
47
+ private
48
+
49
+ def staff_permissions?
50
+ @user.master? or @user.admin? or @user.staff?
51
+ end
52
+
53
+ def admin_permissions?
54
+ @user.master? or @user.admin?
55
+ end
56
+ end
57
+ EOS
58
+ end
59
+ [file_path]
60
+ end
61
+
22
62
  def resolver_head class_name: "souls"
23
63
  FileUtils.mkdir_p "./app/graphql/resolvers" unless Dir.exist? "./app/graphql/resolvers"
24
64
  file_path = "./app/graphql/resolvers/#{class_name.singularize}_search.rb"
@@ -366,6 +406,9 @@ end
366
406
  rspec_resolver_end class_name: singularized_class_name
367
407
  end
368
408
 
409
+
410
+
411
+
369
412
  def add_delete class_name: "souls"
370
413
  singularized_class_name = class_name.singularize.underscore
371
414
  pluralized_class_name = class_name.pluralize.underscore
data/lib/souls/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.17.3"
2
+ VERSION = "0.17.4"
3
3
  end
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: 0.17.3
4
+ version: 0.17.4
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-03-29 00:00:00.000000000 Z
13
+ date: 2021-04-01 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: SOULS is a Web Application Framework for Microservices on Multi Cloud
16
16
  Platform such as Google Cloud Platform, Amazon Web Services, and Alibaba Cloud.