action_policy-graphql 0.3.2 → 0.5.3

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: 4af0cfd306d4128f52758c4336988f29bfa8628f5839aa18e1a54b366c07a9b9
4
- data.tar.gz: 69098890e8c59b44dd2af5a902639dbc407ce190a73e55c1d84b6c9ce464bad0
3
+ metadata.gz: bd65d3395a5a17016bbf6437bdcc300c1c515d3a6ec72aa4a9f499c0f642fbce
4
+ data.tar.gz: 3fde00df90ed713411873303ddf920937c9bcc92d7db37f765eecfc7e03a408c
5
5
  SHA512:
6
- metadata.gz: 2ee55992d03aa2cd350c2c29e9c632c84dff85288a55ef3608e5f277d407f182a98a1bafd820e18caffe4571b1f896cc5608f72979958da0336e6afef0d7f7ef
7
- data.tar.gz: a99cac79463311fecb84d459b537555b9cefe88e0b268b07412d5a0b053ce603c8cea3a426e92cd58033b789d474f008bd3f22b7296270f66e0409f37c0ac6bf
6
+ metadata.gz: 7474adcbe2a40bb7ac9f30ac3068987ac419c56e394dafd1440d6ad1f4457f7a07aa5c5ef8ec07e8fee348bd8e464a753fd4306070a00af500af0e53755925dc
7
+ data.tar.gz: 04aaf4d7dacd8ad07324dc913e45b04a43f515e79ca6de7d530436d357b559bdd52632ae9231a799b9255139d574e744e2a3c1c453e3838213a33d409efea5be
data/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.5.3 (2021-02-26)
6
+
7
+ - Fix compatibility with graphql-ruby 1.12.4 ([@haines][])
8
+
9
+ ## 0.5.2 (2020-10-20)
10
+
11
+ - Fix modules reloading in development. ([@rzaharenkov][])
12
+
13
+ ## 0.5.1 (2020-10-08)
14
+
15
+ - Fix mutations authorization (clean up around `authorize_mutation_raise_exception` configuration parameter). ([@rzaharenkov][])
16
+
17
+ - Add deprecation for using `authorize` for mutation fields. ([@rzaharenkov][])
18
+
19
+ ## 0.5.0 (2020-10-07)
20
+
21
+ - Add `preauthorize_mutation_raise_exception` configuration parameter. ([@palkan][])
22
+
23
+ Similar to `preauthorize_raise_exception` but only for mutations.
24
+ Fallbacks to `preauthorize_raise_exception` unless explicitly specified.
25
+
26
+ - Add `preauthorize_raise_exception` configuration parameter. ([@palkan][])
27
+
28
+ Similar to `authorize_raise_exception` but for `preauthorize: true` fields.
29
+ Fallbacks to `authorize_raise_exception` unless explicitly specified.
30
+
31
+ - Add ability to specify custom field options for `expose_authorization_rules`. ([@bibendi][])
32
+
33
+ Now you can add additional options for underflying `field` call via `field_options` parameter:
34
+
35
+ ```ruby
36
+ expose_authorization_rules :show?, field_options: {camelize: false}
37
+
38
+ # equals to
39
+ field :can_show, ActionPolicy::GraphQL::Types::AuthorizationResult, null: false, camelize: false
40
+ ```
41
+
42
+ ## 0.4.0 (2020-03-11)
43
+
44
+ - **Require Ruby 2.5+**. ([@palkan][])
45
+
46
+ - Add `authorized_field: *` option to perform authorization on the base of the upper object policy prior to resolving fields. ([@sponomarev][])
47
+
5
48
  ## 0.3.2 (2019-12-12)
6
49
 
7
50
  - Fix compatibility with Action Policy 0.4.0 ([@haines][])
@@ -35,3 +78,5 @@ Action Policy helpers there.
35
78
 
36
79
  [@palkan]: https://github.com/palkan
37
80
  [@haines]: https://github.com/haines
81
+ [@sponomarev]: https://github.com/sponomarev
82
+ [@bibendi]: https://github.com/bibendi
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/action_policy-graphql.svg)](https://badge.fury.io/rb/action_policy-graphql)
2
- [![Build Status](https://travis-ci.org/palkan/action_policy-graphql.svg?branch=master)](https://travis-ci.org/palkan/action_policy-graphql)
2
+ ![Build](https://github.com/palkan/action_policy-graphql/workflows/Build/badge.svg)
3
+ ![JRuby Build](https://github.com/palkan/action_policy-graphql/workflows/JRuby%20Build/badge.svg)
3
4
  [![Documentation](https://img.shields.io/badge/docs-link-brightgreen.svg)](https://actionpolicy.evilmartians.io/#/graphql)
4
5
 
5
6
  # Action Policy GraphQL
@@ -7,6 +8,7 @@
7
8
  This gem provides an integration for using [Action Policy](https://github.com/palkan/action_policy) as an authorization framework for GraphQL applications (built with [`graphql` ruby gem](https://graphql-ruby.org)).
8
9
 
9
10
  This integration includes the following features:
11
+
10
12
  - Fields & mutations authorization
11
13
  - List and connections scoping
12
14
  - [**Exposing permissions/authorization rules in the API**](https://evilmartians.com/chronicles/exposing-permissions-in-graphql-apis-with-action-policy).
@@ -21,13 +23,9 @@ This integration includes the following features:
21
23
  Add this line to your application's Gemfile:
22
24
 
23
25
  ```ruby
24
- gem "action_policy-graphql", "~> 0.3"
26
+ gem "action_policy-graphql"
25
27
  ```
26
28
 
27
- And then execute:
28
-
29
- $ bundle
30
-
31
29
  ## Usage
32
30
 
33
31
  **NOTE:** this is a quick overview of the functionality provided by the gem. For more information see the [documentation](https://actionpolicy.evilmartians.io/#/graphql).
@@ -82,6 +80,8 @@ You can customize the authorization options, e.g. `authorize: {to: :preview?, wi
82
80
 
83
81
  If you don't want to raise an exception but return a null instead, you should set a `raise: false` option.
84
82
 
83
+ Note: it does not make too much sense to use `authorize` in mutations since it's checking authorization rules after mutation is executed. Therefore `authorize` marked as deprecated when used in mutations and will raise error in future releases.
84
+
85
85
  ### `authorized_scope: *`
86
86
 
87
87
  You can add `authorized_scope: true` option to the field (list or _connection_ field) to
@@ -98,7 +98,7 @@ class CityType < ::Common::Graphql::Type
98
98
  end
99
99
  ```
100
100
 
101
- **NOTE:** you cannot use `authorize: *` and `authorized_scope: *` at the same time but you can combine `preauthorize: *` with `authorized_scope: *`.
101
+ **NOTE:** you cannot use `authorize: *` and `authorized_scope: *` at the same time but you can combine `preauthorize: *` or `authorize_field: *` with `authorized_scope: *`.
102
102
 
103
103
  ### `preauthorize: *`
104
104
 
@@ -126,7 +126,7 @@ end
126
126
  **NOTE:** we pass the field's name as the `record` to the policy rule. We assume that preauthorization rules do not depend on
127
127
  the record itself and pass the field's name for debugging purposes only.
128
128
 
129
- You can customize the authorization options, e.g. `authorize: {to: :preview?, with: CustomPolicy}`.
129
+ You can customize the authorization options, e.g. `preauthorize: {to: :preview?, with: CustomPolicy}`.
130
130
 
131
131
  **NOTE:** unlike `authorize: *` you MUST specify the `with: SomePolicy` option.
132
132
  The default authorization rule depends on the type of the field:
@@ -134,6 +134,32 @@ The default authorization rule depends on the type of the field:
134
134
  - for lists we use `index?` (configured by `ActionPolicy::GraphQL.default_preauthorize_list_rule` parameter)
135
135
  - for _singleton_ fields we use `show?` (configured by `ActionPolicy::GraphQL.default_preauthorize_node_rule` parameter)
136
136
 
137
+ ### `authorize_field: *`
138
+
139
+ If you want to perform authorization before resolving the field value _on the base of the upper object_, you can use `authorize_field: *` option:
140
+
141
+ ```ruby
142
+ field :homes, Home, null: false, authorize_field: true
143
+
144
+ def homes
145
+ Home.all
146
+ end
147
+ ```
148
+
149
+ The code above is equal to:
150
+
151
+ ```ruby
152
+ field :homes, [Home], null: false
153
+
154
+ def homes
155
+ authorize! object, to: :homes?
156
+ Home.all
157
+ end
158
+ ```
159
+ By default we use `#{underscored_field_name}?` authorization rule.
160
+
161
+ You can customize the authorization options, e.g. `authorize_field: {to: :preview?, with: CustomPolicy}`.
162
+
137
163
  ### `expose_authorization_rules`
138
164
 
139
165
  You can add permissions/authorization exposing fields to "tell" clients which actions could be performed against the object or not (and why).
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "ruby-next"
3
4
  require "action_policy/graphql"
@@ -30,12 +30,33 @@ module ActionPolicy
30
30
  # Which prefix to use for authorization fields
31
31
  # Defaults to `"can_"`
32
32
  attr_accessor :default_authorization_field_prefix
33
+
34
+ attr_writer :preauthorize_raise_exception
35
+
36
+ # Whether to raise an exception if preauthorization fails
37
+ # Equals to authorize_raise_exception unless explicitly set
38
+ def preauthorize_raise_exception
39
+ return authorize_raise_exception if @preauthorize_raise_exception.nil?
40
+ @preauthorize_raise_exception
41
+ end
42
+
43
+ # Whether to raise an exception if preauthorization fails
44
+ # Equals to preauthorize_raise_exception unless explicitly set
45
+ attr_writer :preauthorize_mutation_raise_exception
46
+
47
+ def preauthorize_mutation_raise_exception
48
+ return preauthorize_raise_exception if @preauthorize_mutation_raise_exception.nil?
49
+
50
+ @preauthorize_mutation_raise_exception
51
+ end
33
52
  end
34
53
 
35
54
  self.default_authorize_rule = :show?
36
55
  self.default_preauthorize_list_rule = :index?
37
56
  self.default_preauthorize_node_rule = :show?
38
57
  self.authorize_raise_exception = true
58
+ self.preauthorize_raise_exception = nil
59
+ self.preauthorize_mutation_raise_exception = nil
39
60
  self.default_authorization_field_prefix = "can_"
40
61
  end
41
62
  end
@@ -22,7 +22,25 @@ module ActionPolicy
22
22
  end
23
23
 
24
24
  class AuthorizeExtension < Extension
25
+ DEPRECATION_MESSAGE = "`authorize: *` for mutation fields is deprecated. Please use `preauthorize: *` instead."
26
+
27
+ class << self
28
+ def show_authorize_mutation_deprecation
29
+ return if defined?(@authorize_mutation_deprecation_shown)
30
+
31
+ if defined?(ActiveSupport::Deprecation)
32
+ ActiveSupport::Deprecation.warn(DEPRECATION_MESSAGE)
33
+ else
34
+ warn(DEPRECATION_MESSAGE)
35
+ end
36
+
37
+ @authorize_mutation_deprecation_shown = true
38
+ end
39
+ end
40
+
25
41
  def apply
42
+ self.class.show_authorize_mutation_deprecation if field.mutation && field.mutation < ::GraphQL::Schema::Mutation
43
+
26
44
  @to = extract_option(:to) { ::ActionPolicy::GraphQL.default_authorize_rule }
27
45
  @raise = extract_option(:raise) { ::ActionPolicy::GraphQL.authorize_raise_exception }
28
46
  end
@@ -54,7 +72,13 @@ module ActionPolicy
54
72
  end
55
73
  end
56
74
 
57
- @raise = extract_option(:raise) { ::ActionPolicy::GraphQL.authorize_raise_exception }
75
+ @raise = extract_option(:raise) do
76
+ if field.mutation
77
+ ::ActionPolicy::GraphQL.preauthorize_mutation_raise_exception
78
+ else
79
+ ::ActionPolicy::GraphQL.preauthorize_raise_exception
80
+ end
81
+ end
58
82
  end
59
83
 
60
84
  def resolve(context:, object:, arguments:, **_rest)
@@ -67,22 +91,45 @@ module ActionPolicy
67
91
  end
68
92
  end
69
93
 
94
+ class AuthorizeFieldExtension < Extension
95
+ def apply
96
+ @to = extract_option(:to) { underscored_field_name }
97
+ @raise = extract_option(:raise) { ::ActionPolicy::GraphQL.authorize_raise_exception }
98
+ end
99
+
100
+ def resolve(context:, object:, arguments:, **_rest)
101
+ if @raise
102
+ object.authorize! object.object, to: @to, **options
103
+ yield object, arguments
104
+ elsif object.allowed_to?(@to, object.object, **options)
105
+ yield object, arguments
106
+ end
107
+ end
108
+
109
+ private
110
+
111
+ def underscored_field_name
112
+ "#{field.instance_variable_get(:@underscored_name)}?".to_sym
113
+ end
114
+ end
115
+
70
116
  class ScopeExtension < Extension
71
- def after_resolve(value:, context:, object:, **_rest)
117
+ def resolve(context:, object:, arguments:, **_rest)
118
+ value = yield(object, arguments)
72
119
  return value if value.nil?
73
120
 
74
121
  object.authorized_scope(value, **options)
75
122
  end
76
123
  end
77
124
 
78
- def initialize(*args, preauthorize: nil, authorize: nil, authorized_scope: nil, **kwargs, &block)
125
+ def initialize(*args, preauthorize: nil, authorize: nil, authorized_scope: nil, authorize_field: nil, **kwargs, &block)
79
126
  if authorize && authorized_scope
80
127
  raise ArgumentError, "Only one of `authorize` and `authorized_scope` " \
81
- "options could be specified. You can use `preauthorize` along with scoping"
128
+ "options could be specified. You can use `preauthorize` or `authorize_field` along with scoping"
82
129
  end
83
130
 
84
- if authorize && preauthorize
85
- raise ArgumentError, "Only one of `authorize` and `preauthorize` " \
131
+ if !!authorize == !!preauthorize ? authorize : authorize_field
132
+ raise ArgumentError, "Only one of `authorize`, `preauthorize` or `authorize_field` " \
86
133
  "options could be specified."
87
134
  end
88
135
 
@@ -91,6 +138,7 @@ module ActionPolicy
91
138
  add_extension! extensions, AuthorizeExtension, authorize
92
139
  add_extension! extensions, ScopeExtension, authorized_scope
93
140
  add_extension! extensions, PreauthorizeExtension, preauthorize
141
+ add_extension! extensions, AuthorizeFieldExtension, authorize_field
94
142
 
95
143
  super(*args, **kwargs, &block)
96
144
  end
@@ -37,8 +37,13 @@ module ActionPolicy
37
37
  base.authorize :user, through: :current_user
38
38
 
39
39
  if base.respond_to?(:field_class)
40
- base.field_class.prepend(ActionPolicy::GraphQL::AuthorizedField)
41
- base.include ActionPolicy::GraphQL::Fields
40
+ unless base.field_class < ActionPolicy::GraphQL::AuthorizedField
41
+ base.field_class.prepend(ActionPolicy::GraphQL::AuthorizedField)
42
+ end
43
+
44
+ unless base < ActionPolicy::GraphQL::Fields
45
+ base.include ActionPolicy::GraphQL::Fields
46
+ end
42
47
  end
43
48
 
44
49
  base.extend self
@@ -3,10 +3,7 @@
3
3
  require "action_policy/graphql/types/authorization_result"
4
4
 
5
5
  module ActionPolicy
6
- unless "".respond_to?(:then)
7
- require "action_policy/ext/yield_self_then"
8
- using ActionPolicy::Ext::YieldSelfThen
9
- end
6
+ using RubyNext
10
7
 
11
8
  module GraphQL
12
9
  # Add DSL to add policy rules as fields
@@ -26,26 +23,20 @@ module ActionPolicy
26
23
  base.extend ClassMethods
27
24
  end
28
25
 
29
- def allowance_to(rule, target = object, **options)
30
- policy_for(record: target, **options).then do |policy|
31
- policy.apply(authorization_rule_for(policy, rule))
32
- policy.result
33
- end
34
- end
35
-
36
26
  module ClassMethods
37
- def expose_authorization_rules(*rules, field_name: nil, prefix: ::ActionPolicy::GraphQL.default_authorization_field_prefix, **options)
27
+ def expose_authorization_rules(*rules, field_name: nil, prefix: ::ActionPolicy::GraphQL.default_authorization_field_prefix, field_options: {}, **options)
38
28
  raise ArgumentError, "Cannot specify field_name for multiple rules" if rules.size > 1 && !field_name.nil?
39
29
 
40
30
  rules.each do |rule|
41
31
  gql_field_name = field_name || "#{prefix}#{rule.to_s.delete("?")}"
42
32
 
43
33
  field gql_field_name,
44
- ActionPolicy::GraphQL::Types::AuthorizationResult,
45
- null: false
34
+ ActionPolicy::GraphQL::Types::AuthorizationResult,
35
+ null: false,
36
+ **field_options
46
37
 
47
38
  define_method(gql_field_name) do
48
- allowance_to(rule, options)
39
+ allowance_to(rule, object, **options)
49
40
  end
50
41
  end
51
42
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActionPolicy
4
4
  module GraphQL
5
- VERSION = "0.3.2"
5
+ VERSION = "0.5.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_policy-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2021-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: action_policy
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.0
19
+ version: 0.5.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.0
26
+ version: 0.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-next-core
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: graphql
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +72,14 @@ dependencies:
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '10.0'
75
+ version: '13.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '10.0'
82
+ version: '13.0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,48 +94,6 @@ dependencies:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
96
  version: '3.8'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.67.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.67.0
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-md
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.3'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.3'
111
- - !ruby/object:Gem::Dependency
112
- name: standard
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.0.39
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.0.39
125
97
  - !ruby/object:Gem::Dependency
126
98
  name: i18n
127
99
  requirement: !ruby/object:Gem::Requirement
@@ -143,21 +115,9 @@ executables: []
143
115
  extensions: []
144
116
  extra_rdoc_files: []
145
117
  files:
146
- - ".gitignore"
147
- - ".rubocop.yml"
148
- - ".travis.yml"
149
118
  - CHANGELOG.md
150
- - Gemfile
151
119
  - LICENSE.txt
152
120
  - README.md
153
- - Rakefile
154
- - action_policy-graphql.gemspec
155
- - bin/console
156
- - bin/setup
157
- - gemfiles/action_policy/0.3.gemfile
158
- - gemfiles/action_policy/master.gemfile
159
- - gemfiles/graphql/master.gemfile
160
- - gemfiles/jruby.gemfile
161
121
  - lib/action_policy-graphql.rb
162
122
  - lib/action_policy/graphql.rb
163
123
  - lib/action_policy/graphql/authorized_field.rb
@@ -183,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
143
  requirements:
184
144
  - - ">="
185
145
  - !ruby/object:Gem::Version
186
- version: 2.4.0
146
+ version: 2.5.0
187
147
  required_rubygems_version: !ruby/object:Gem::Requirement
188
148
  requirements:
189
149
  - - ">="
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- Gemfile.local
data/.rubocop.yml DELETED
@@ -1,54 +0,0 @@
1
- require:
2
- - standard/cop/semantic_blocks
3
- - rubocop-md
4
-
5
- inherit_gem:
6
- standard: config/base.yml
7
-
8
- AllCops:
9
- Exclude:
10
- - 'bin/*'
11
- - 'tmp/**/*'
12
- - 'Gemfile'
13
- - 'vendor/**/*'
14
- - 'gemfiles/**/*'
15
- DisplayCopNames: true
16
- TargetRubyVersion: 2.4
17
-
18
- Standard/SemanticBlocks:
19
- Enabled: false
20
-
21
- Style/FrozenStringLiteralComment:
22
- Enabled: true
23
-
24
- Style/TrailingCommaInArrayLiteral:
25
- EnforcedStyleForMultiline: no_comma
26
-
27
- Style/TrailingCommaInHashLiteral:
28
- EnforcedStyleForMultiline: no_comma
29
-
30
- Layout/AlignParameters:
31
- EnforcedStyle: with_first_parameter
32
-
33
- Lint/Void:
34
- Exclude:
35
- - '**/*.md'
36
-
37
- # See https://github.com/rubocop-hq/rubocop/issues/4222
38
- Lint/AmbiguousBlockAssociation:
39
- Exclude:
40
- - 'spec/**/*'
41
- - '**/*.md'
42
-
43
- Lint/DuplicateMethods:
44
- Exclude:
45
- - '**/*.md'
46
-
47
- Naming/FileName:
48
- Exclude:
49
- - 'lib/action_policy-graphql.rb'
50
- - '**/*.md'
51
-
52
- Layout/InitialIndentation:
53
- Exclude:
54
- - 'CHANGELOG.md'
data/.travis.yml DELETED
@@ -1,39 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- notifications:
5
- email: false
6
-
7
- before_install:
8
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
9
- - gem install bundler -v '< 2'
10
-
11
- script:
12
- - bundle exec rake
13
-
14
- matrix:
15
- fast_finish: true
16
- include:
17
- - rvm: ruby-head
18
- gemfile: gemfiles/graphql/master.gemfile
19
- - rvm: 2.6
20
- gemfile: gemfiles/graphql/master.gemfile
21
- - rvm: 2.6
22
- gemfile: gemfiles/action_policy/master.gemfile
23
- - rvm: 2.6
24
- gemfile: gemfiles/action_policy/0.3.gemfile
25
- - rvm: jruby-9.2.5.0
26
- gemfile: gemfiles/jruby.gemfile
27
- - rvm: 2.6
28
- gemfile: Gemfile
29
- - rvm: 2.5
30
- gemfile: Gemfile
31
- - rvm: 2.4
32
- gemfile: Gemfile
33
- allow_failures:
34
- - rvm: ruby-head
35
- gemfile: gemfiles/graphql/master.gemfile
36
- - rvm: 2.6
37
- gemfile: gemfiles/graphql/master.gemfile
38
- - rvm: 2.6
39
- gemfile: gemfiles/action_policy/master.gemfile
data/Gemfile DELETED
@@ -1,16 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in action_policy-graphql.gemspec
4
- gemspec
5
-
6
- gem "pry-byebug", platform: :mri
7
-
8
- local_gemfile = File.join(__dir__, "Gemfile.local")
9
-
10
- if File.exist?(local_gemfile)
11
- # Specify custom action_policy/graphql-ruby version in Gemfile.local
12
- eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
13
- else
14
- gem "action_policy", "~> 0.4.0"
15
- gem "graphql", "~> 1.9.3"
16
- end
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop/rake_task"
4
- require "rspec/core/rake_task"
5
-
6
- RuboCop::RakeTask.new
7
-
8
- RSpec::Core::RakeTask.new(:spec)
9
-
10
- task default: [:rubocop, :spec]
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path("../lib", __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "action_policy/graphql/version"
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "action_policy-graphql"
9
- spec.version = ActionPolicy::GraphQL::VERSION
10
- spec.authors = ["Vladimir Dementyev"]
11
- spec.email = ["dementiev.vm@gmail.com"]
12
-
13
- spec.summary = "Action Policy integration for GraphQL-Ruby"
14
- spec.description = "Action Policy integration for GraphQL-Ruby"
15
- spec.homepage = "https://github.com/palkan/action_policy-graphql"
16
- spec.license = "MIT"
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
-
22
- spec.metadata = {
23
- "bug_tracker_uri" => "https://github.com/palkan/action_policy-graphql/issues",
24
- "changelog_uri" => "https://github.com/palkan/action_policy-graphql/blob/master/CHANGELOG.md",
25
- "documentation_uri" => "https://actionpolicy.evilmartians.io/#/graphql",
26
- "homepage_uri" => "https://github.com/palkan/action_policy-graphql",
27
- "source_code_uri" => "https://github.com/palkan/action_policy-graphql"
28
- }
29
-
30
- spec.require_paths = ["lib"]
31
-
32
- spec.required_ruby_version = ">= 2.4.0"
33
-
34
- spec.add_dependency "action_policy", ">= 0.3.0"
35
- spec.add_dependency "graphql", ">= 1.9.3"
36
-
37
- spec.add_development_dependency "bundler", ">= 1.15"
38
- spec.add_development_dependency "rake", "~> 10.0"
39
- spec.add_development_dependency "rspec", "~> 3.8"
40
- spec.add_development_dependency "rubocop", "~> 0.67.0"
41
- spec.add_development_dependency "rubocop-md", "~> 0.3"
42
- spec.add_development_dependency "standard", "~> 0.0.39"
43
- spec.add_development_dependency "i18n"
44
- end
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "action_policy/graphql"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "action_policy", "~> 0.3.0"
4
-
5
- gemspec path: "../.."
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "action_policy", github: "palkan/action_policy"
4
-
5
- gemspec path: "../.."
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "graphql", github: "rmosolgo/graphql-ruby"
4
-
5
- gemspec path: "../.."
@@ -1,3 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec path: ".."