declarative_policy 1.1.0 → 2.1.0
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/CHANGELOG.md +14 -0
- data/README.md +90 -9
- data/{declarative_policy.gemspec → declarative-policy.gemspec} +23 -8
- data/doc/caching.md +7 -7
- data/doc/defining-policies.md +83 -9
- data/doc/optimization.md +1 -1
- data/lib/declarative_policy/base.rb +25 -6
- data/lib/declarative_policy/condition.rb +22 -5
- data/lib/declarative_policy/configuration.rb +1 -1
- data/lib/declarative_policy/delegate_dsl.rb +1 -1
- data/lib/declarative_policy/policy_dsl.rb +10 -4
- data/lib/declarative_policy/preferred_scope.rb +1 -1
- data/lib/declarative_policy/prevent_all_dsl.rb +25 -0
- data/lib/declarative_policy/rule_dsl.rb +1 -1
- data/lib/declarative_policy/runner.rb +1 -1
- data/lib/declarative_policy/version.rb +1 -1
- data/lib/declarative_policy.rb +1 -0
- metadata +112 -24
- data/.gitignore +0 -12
- data/.gitlab-ci.yml +0 -91
- data/.rspec +0 -4
- data/.rubocop.yml +0 -13
- data/Dangerfile +0 -16
- data/Gemfile +0 -23
- data/Gemfile.lock +0 -214
- data/Rakefile +0 -8
- data/benchmarks/repeated_invocation.rb +0 -37
- data/danger/plugins/project_helper.rb +0 -58
- data/danger/roulette/Dangerfile +0 -97
data/lib/declarative_policy.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'set'
|
|
|
4
4
|
require_relative 'declarative_policy/cache'
|
|
5
5
|
require_relative 'declarative_policy/condition'
|
|
6
6
|
require_relative 'declarative_policy/delegate_dsl'
|
|
7
|
+
require_relative 'declarative_policy/prevent_all_dsl'
|
|
7
8
|
require_relative 'declarative_policy/policy_dsl'
|
|
8
9
|
require_relative 'declarative_policy/rule_dsl'
|
|
9
10
|
require_relative 'declarative_policy/preferred_scope'
|
metadata
CHANGED
|
@@ -1,16 +1,113 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: declarative_policy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
- Alexis Kalderimis
|
|
7
|
+
- group::authorization
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
13
|
-
dependencies:
|
|
11
|
+
date: 2026-03-13 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: benchmark-ips
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: gitlab-dangerfiles
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3.8'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.8'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: gitlab-styles
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '12.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '12.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry-byebug
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rake
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '12.0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '12.0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.10'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.10'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec-parameterized
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '1.0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '1.0'
|
|
14
111
|
description: |
|
|
15
112
|
This library provides an authorization framework with a declarative DSL
|
|
16
113
|
|
|
@@ -19,28 +116,17 @@ description: |
|
|
|
19
116
|
|
|
20
117
|
This library is in production use at GitLab.com
|
|
21
118
|
email:
|
|
22
|
-
-
|
|
119
|
+
- engineering@gitlab.com
|
|
23
120
|
executables: []
|
|
24
121
|
extensions: []
|
|
25
122
|
extra_rdoc_files: []
|
|
26
123
|
files:
|
|
27
|
-
- ".gitignore"
|
|
28
|
-
- ".gitlab-ci.yml"
|
|
29
|
-
- ".rspec"
|
|
30
|
-
- ".rubocop.yml"
|
|
31
124
|
- CHANGELOG.md
|
|
32
125
|
- CODE_OF_CONDUCT.md
|
|
33
126
|
- CONTRIBUTING.md
|
|
34
|
-
- Dangerfile
|
|
35
|
-
- Gemfile
|
|
36
|
-
- Gemfile.lock
|
|
37
127
|
- LICENSE.txt
|
|
38
128
|
- README.md
|
|
39
|
-
-
|
|
40
|
-
- benchmarks/repeated_invocation.rb
|
|
41
|
-
- danger/plugins/project_helper.rb
|
|
42
|
-
- danger/roulette/Dangerfile
|
|
43
|
-
- declarative_policy.gemspec
|
|
129
|
+
- declarative-policy.gemspec
|
|
44
130
|
- doc/caching.md
|
|
45
131
|
- doc/configuration.md
|
|
46
132
|
- doc/defining-policies.md
|
|
@@ -54,18 +140,20 @@ files:
|
|
|
54
140
|
- lib/declarative_policy/nil_policy.rb
|
|
55
141
|
- lib/declarative_policy/policy_dsl.rb
|
|
56
142
|
- lib/declarative_policy/preferred_scope.rb
|
|
143
|
+
- lib/declarative_policy/prevent_all_dsl.rb
|
|
57
144
|
- lib/declarative_policy/rule.rb
|
|
58
145
|
- lib/declarative_policy/rule_dsl.rb
|
|
59
146
|
- lib/declarative_policy/runner.rb
|
|
60
147
|
- lib/declarative_policy/step.rb
|
|
61
148
|
- lib/declarative_policy/version.rb
|
|
62
|
-
homepage: https://gitlab.com/gitlab-org/declarative-policy
|
|
149
|
+
homepage: https://gitlab.com/gitlab-org/ruby/gems/declarative-policy
|
|
63
150
|
licenses:
|
|
64
151
|
- MIT
|
|
65
152
|
metadata:
|
|
66
|
-
homepage_uri: https://gitlab.com/gitlab-org/declarative-policy
|
|
67
|
-
source_code_uri: https://gitlab.com/gitlab-org/declarative-policy
|
|
68
|
-
changelog_uri: https://gitlab.com/gitlab-org/declarative-policy/-/
|
|
153
|
+
homepage_uri: https://gitlab.com/gitlab-org/ruby/gems/declarative-policy
|
|
154
|
+
source_code_uri: https://gitlab.com/gitlab-org/ruby/gems/declarative-policy
|
|
155
|
+
changelog_uri: https://gitlab.com/gitlab-org/ruby/gems/declarative-policy/-/releases
|
|
156
|
+
rubygems_mfa_required: 'false'
|
|
69
157
|
post_install_message:
|
|
70
158
|
rdoc_options: []
|
|
71
159
|
require_paths:
|
|
@@ -74,14 +162,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
74
162
|
requirements:
|
|
75
163
|
- - ">="
|
|
76
164
|
- !ruby/object:Gem::Version
|
|
77
|
-
version:
|
|
165
|
+
version: 3.0.0
|
|
78
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
167
|
requirements:
|
|
80
168
|
- - ">="
|
|
81
169
|
- !ruby/object:Gem::Version
|
|
82
170
|
version: '0'
|
|
83
171
|
requirements: []
|
|
84
|
-
rubygems_version: 3.
|
|
172
|
+
rubygems_version: 3.5.22
|
|
85
173
|
signing_key:
|
|
86
174
|
specification_version: 4
|
|
87
175
|
summary: An authorization library with a focus on declarative policy definitions.
|
data/.gitignore
DELETED
data/.gitlab-ci.yml
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
image: "ruby:2.7"
|
|
2
|
-
|
|
3
|
-
include:
|
|
4
|
-
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
|
5
|
-
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
|
6
|
-
- template: Security/License-Scanning.gitlab-ci.yml
|
|
7
|
-
- template: Security/SAST.gitlab-ci.yml
|
|
8
|
-
- template: Security/Secret-Detection.gitlab-ci.yml
|
|
9
|
-
|
|
10
|
-
.tests:
|
|
11
|
-
stage: test
|
|
12
|
-
cache:
|
|
13
|
-
paths:
|
|
14
|
-
- vendor/ruby
|
|
15
|
-
before_script:
|
|
16
|
-
- ruby -v # Print out ruby version for debugging
|
|
17
|
-
- bundle install -j $(nproc) --path vendor/ruby/$RUBY_VERSION
|
|
18
|
-
|
|
19
|
-
rubocop:
|
|
20
|
-
extends: .tests
|
|
21
|
-
script:
|
|
22
|
-
- bundle exec rubocop
|
|
23
|
-
|
|
24
|
-
.rspec:
|
|
25
|
-
extends: .tests
|
|
26
|
-
script:
|
|
27
|
-
- bundle exec rspec
|
|
28
|
-
|
|
29
|
-
rspec:mri:
|
|
30
|
-
extends: .rspec
|
|
31
|
-
image: "ruby:$RUBY_VERSION"
|
|
32
|
-
parallel:
|
|
33
|
-
matrix:
|
|
34
|
-
- RUBY_VERSION:
|
|
35
|
-
- "2.7"
|
|
36
|
-
- "3.0"
|
|
37
|
-
|
|
38
|
-
rspec:jruby:
|
|
39
|
-
extends: .rspec
|
|
40
|
-
image: "bitnami/jruby:latest"
|
|
41
|
-
variables:
|
|
42
|
-
RUBY_VERSION: jruby
|
|
43
|
-
|
|
44
|
-
rspec:truffleruby:
|
|
45
|
-
extends: .rspec
|
|
46
|
-
image: "flavorjones/truffleruby:latest"
|
|
47
|
-
variables:
|
|
48
|
-
RUBY_VERSION: truffleruby
|
|
49
|
-
|
|
50
|
-
danger-review:
|
|
51
|
-
extends: .tests
|
|
52
|
-
needs: []
|
|
53
|
-
script:
|
|
54
|
-
- >
|
|
55
|
-
if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
|
|
56
|
-
# Force danger to skip CI source GitLab and fallback to "local only git repo".
|
|
57
|
-
unset GITLAB_CI
|
|
58
|
-
# We need to base SHA to help danger determine the base commit for this shallow clone.
|
|
59
|
-
bundle exec danger dry_run --fail-on-errors=true --verbose --base="$CI_MERGE_REQUEST_DIFF_BASE_SHA"
|
|
60
|
-
else
|
|
61
|
-
bundle exec danger --fail-on-errors=true --verbose
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
# run security jobs on MRs
|
|
65
|
-
# see: https://gitlab.com/gitlab-org/gitlab/-/issues/218444#note_478761991
|
|
66
|
-
|
|
67
|
-
brakeman-sast:
|
|
68
|
-
rules:
|
|
69
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
70
|
-
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
71
|
-
|
|
72
|
-
gemnasium-dependency_scanning:
|
|
73
|
-
rules:
|
|
74
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
75
|
-
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
76
|
-
|
|
77
|
-
bundler-audit-dependency_scanning:
|
|
78
|
-
rules:
|
|
79
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
80
|
-
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
81
|
-
|
|
82
|
-
license_scanning:
|
|
83
|
-
rules:
|
|
84
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
85
|
-
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
86
|
-
|
|
87
|
-
secret_detection:
|
|
88
|
-
rules:
|
|
89
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
90
|
-
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
91
|
-
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/Dangerfile
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'gitlab-dangerfiles'
|
|
4
|
-
|
|
5
|
-
Gitlab::Dangerfiles.import_plugins(danger)
|
|
6
|
-
danger.import_plugin('danger/plugins/*.rb')
|
|
7
|
-
|
|
8
|
-
return if helper.release_automation?
|
|
9
|
-
|
|
10
|
-
danger.import_dangerfile(path: File.join('danger', 'roulette'))
|
|
11
|
-
|
|
12
|
-
anything_to_post = status_report.values.any?(&:any?)
|
|
13
|
-
|
|
14
|
-
if helper.ci? && anything_to_post
|
|
15
|
-
markdown("**If needed, you can retry the [`danger-review` job](#{ENV['CI_JOB_URL']}) that generated this comment.**")
|
|
16
|
-
end
|
data/Gemfile
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source 'https://rubygems.org'
|
|
4
|
-
|
|
5
|
-
# Specify your gem's dependencies in declarative-policy.gemspec
|
|
6
|
-
gemspec
|
|
7
|
-
|
|
8
|
-
group :test do
|
|
9
|
-
gem 'rspec', '~> 3.10'
|
|
10
|
-
gem 'rspec-parameterized', require: false
|
|
11
|
-
gem 'pry-byebug', platforms: [:ruby]
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
group :development, :test do
|
|
15
|
-
gem 'gitlab-styles', '~> 6.1.0', require: false, platforms: [:ruby]
|
|
16
|
-
gem 'rake', '~> 12.0'
|
|
17
|
-
gem 'benchmark', require: false
|
|
18
|
-
gem 'rubocop', require: false
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
group :development, :test, :danger do
|
|
22
|
-
gem 'gitlab-dangerfiles', '~> 1.1.0', require: false, platforms: [:ruby]
|
|
23
|
-
end
|
data/Gemfile.lock
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
declarative_policy (1.1.0)
|
|
5
|
-
|
|
6
|
-
GEM
|
|
7
|
-
remote: https://rubygems.org/
|
|
8
|
-
specs:
|
|
9
|
-
abstract_type (0.0.7)
|
|
10
|
-
activesupport (6.1.3.2)
|
|
11
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
12
|
-
i18n (>= 1.6, < 2)
|
|
13
|
-
minitest (>= 5.1)
|
|
14
|
-
tzinfo (~> 2.0)
|
|
15
|
-
zeitwerk (~> 2.3)
|
|
16
|
-
adamantium (0.2.0)
|
|
17
|
-
ice_nine (~> 0.11.0)
|
|
18
|
-
memoizable (~> 0.4.0)
|
|
19
|
-
addressable (2.7.0)
|
|
20
|
-
public_suffix (>= 2.0.2, < 5.0)
|
|
21
|
-
ast (2.4.2)
|
|
22
|
-
benchmark (0.1.1)
|
|
23
|
-
binding_ninja (0.2.3)
|
|
24
|
-
binding_ninja (0.2.3-java)
|
|
25
|
-
byebug (11.1.3)
|
|
26
|
-
claide (1.0.3)
|
|
27
|
-
claide-plugins (0.9.2)
|
|
28
|
-
cork
|
|
29
|
-
nap
|
|
30
|
-
open4 (~> 1.3)
|
|
31
|
-
coderay (1.1.3)
|
|
32
|
-
colored2 (3.1.2)
|
|
33
|
-
concord (0.1.5)
|
|
34
|
-
adamantium (~> 0.2.0)
|
|
35
|
-
equalizer (~> 0.0.9)
|
|
36
|
-
concurrent-ruby (1.1.8)
|
|
37
|
-
cork (0.3.0)
|
|
38
|
-
colored2 (~> 3.1)
|
|
39
|
-
danger (8.2.3)
|
|
40
|
-
claide (~> 1.0)
|
|
41
|
-
claide-plugins (>= 0.9.2)
|
|
42
|
-
colored2 (~> 3.1)
|
|
43
|
-
cork (~> 0.1)
|
|
44
|
-
faraday (>= 0.9.0, < 2.0)
|
|
45
|
-
faraday-http-cache (~> 2.0)
|
|
46
|
-
git (~> 1.7)
|
|
47
|
-
kramdown (~> 2.3)
|
|
48
|
-
kramdown-parser-gfm (~> 1.0)
|
|
49
|
-
no_proxy_fix
|
|
50
|
-
octokit (~> 4.7)
|
|
51
|
-
terminal-table (>= 1, < 4)
|
|
52
|
-
danger-gitlab (8.0.0)
|
|
53
|
-
danger
|
|
54
|
-
gitlab (~> 4.2, >= 4.2.0)
|
|
55
|
-
diff-lcs (1.4.4)
|
|
56
|
-
equalizer (0.0.11)
|
|
57
|
-
faraday (1.4.1)
|
|
58
|
-
faraday-excon (~> 1.1)
|
|
59
|
-
faraday-net_http (~> 1.0)
|
|
60
|
-
faraday-net_http_persistent (~> 1.1)
|
|
61
|
-
multipart-post (>= 1.2, < 3)
|
|
62
|
-
ruby2_keywords (>= 0.0.4)
|
|
63
|
-
faraday-excon (1.1.0)
|
|
64
|
-
faraday-http-cache (2.2.0)
|
|
65
|
-
faraday (>= 0.8)
|
|
66
|
-
faraday-net_http (1.0.1)
|
|
67
|
-
faraday-net_http_persistent (1.1.0)
|
|
68
|
-
ffi (1.15.4-java)
|
|
69
|
-
git (1.8.1)
|
|
70
|
-
rchardet (~> 1.8)
|
|
71
|
-
gitlab (4.17.0)
|
|
72
|
-
httparty (~> 0.18)
|
|
73
|
-
terminal-table (~> 1.5, >= 1.5.1)
|
|
74
|
-
gitlab-dangerfiles (1.1.1)
|
|
75
|
-
danger-gitlab
|
|
76
|
-
gitlab-styles (6.1.0)
|
|
77
|
-
rubocop (~> 0.91, >= 0.91.1)
|
|
78
|
-
rubocop-gitlab-security (~> 0.1.1)
|
|
79
|
-
rubocop-performance (~> 1.9.2)
|
|
80
|
-
rubocop-rails (~> 2.9)
|
|
81
|
-
rubocop-rspec (~> 1.44)
|
|
82
|
-
httparty (0.18.1)
|
|
83
|
-
mime-types (~> 3.0)
|
|
84
|
-
multi_xml (>= 0.5.2)
|
|
85
|
-
i18n (1.8.10)
|
|
86
|
-
concurrent-ruby (~> 1.0)
|
|
87
|
-
ice_nine (0.11.2)
|
|
88
|
-
kramdown (2.3.1)
|
|
89
|
-
rexml
|
|
90
|
-
kramdown-parser-gfm (1.1.0)
|
|
91
|
-
kramdown (~> 2.0)
|
|
92
|
-
memoizable (0.4.2)
|
|
93
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
|
94
|
-
method_source (1.0.0)
|
|
95
|
-
mime-types (3.3.1)
|
|
96
|
-
mime-types-data (~> 3.2015)
|
|
97
|
-
mime-types-data (3.2021.0225)
|
|
98
|
-
minitest (5.14.4)
|
|
99
|
-
multi_xml (0.6.0)
|
|
100
|
-
multipart-post (2.1.1)
|
|
101
|
-
nap (1.1.0)
|
|
102
|
-
no_proxy_fix (0.1.2)
|
|
103
|
-
octokit (4.21.0)
|
|
104
|
-
faraday (>= 0.9)
|
|
105
|
-
sawyer (~> 0.8.0, >= 0.5.3)
|
|
106
|
-
open4 (1.3.4)
|
|
107
|
-
parallel (1.20.1)
|
|
108
|
-
parser (3.0.0.0)
|
|
109
|
-
ast (~> 2.4.1)
|
|
110
|
-
proc_to_ast (0.1.0)
|
|
111
|
-
coderay
|
|
112
|
-
parser
|
|
113
|
-
unparser
|
|
114
|
-
procto (0.0.3)
|
|
115
|
-
pry (0.13.1)
|
|
116
|
-
coderay (~> 1.1)
|
|
117
|
-
method_source (~> 1.0)
|
|
118
|
-
pry (0.13.1-java)
|
|
119
|
-
coderay (~> 1.1)
|
|
120
|
-
method_source (~> 1.0)
|
|
121
|
-
spoon (~> 0.0)
|
|
122
|
-
pry-byebug (3.9.0)
|
|
123
|
-
byebug (~> 11.0)
|
|
124
|
-
pry (~> 0.13.0)
|
|
125
|
-
public_suffix (4.0.6)
|
|
126
|
-
rack (2.2.3)
|
|
127
|
-
rainbow (3.0.0)
|
|
128
|
-
rake (12.3.3)
|
|
129
|
-
rchardet (1.8.0)
|
|
130
|
-
regexp_parser (1.8.2)
|
|
131
|
-
rexml (3.2.4)
|
|
132
|
-
rspec (3.10.0)
|
|
133
|
-
rspec-core (~> 3.10.0)
|
|
134
|
-
rspec-expectations (~> 3.10.0)
|
|
135
|
-
rspec-mocks (~> 3.10.0)
|
|
136
|
-
rspec-core (3.10.1)
|
|
137
|
-
rspec-support (~> 3.10.0)
|
|
138
|
-
rspec-expectations (3.10.1)
|
|
139
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
140
|
-
rspec-support (~> 3.10.0)
|
|
141
|
-
rspec-mocks (3.10.2)
|
|
142
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
143
|
-
rspec-support (~> 3.10.0)
|
|
144
|
-
rspec-parameterized (0.4.2)
|
|
145
|
-
binding_ninja (>= 0.2.3)
|
|
146
|
-
parser
|
|
147
|
-
proc_to_ast
|
|
148
|
-
rspec (>= 2.13, < 4)
|
|
149
|
-
unparser
|
|
150
|
-
rspec-support (3.10.2)
|
|
151
|
-
rubocop (0.93.1)
|
|
152
|
-
parallel (~> 1.10)
|
|
153
|
-
parser (>= 2.7.1.5)
|
|
154
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
155
|
-
regexp_parser (>= 1.8)
|
|
156
|
-
rexml
|
|
157
|
-
rubocop-ast (>= 0.6.0)
|
|
158
|
-
ruby-progressbar (~> 1.7)
|
|
159
|
-
unicode-display_width (>= 1.4.0, < 2.0)
|
|
160
|
-
rubocop-ast (1.4.1)
|
|
161
|
-
parser (>= 2.7.1.5)
|
|
162
|
-
rubocop-gitlab-security (0.1.1)
|
|
163
|
-
rubocop (>= 0.51)
|
|
164
|
-
rubocop-performance (1.9.2)
|
|
165
|
-
rubocop (>= 0.90.0, < 2.0)
|
|
166
|
-
rubocop-ast (>= 0.4.0)
|
|
167
|
-
rubocop-rails (2.9.1)
|
|
168
|
-
activesupport (>= 4.2.0)
|
|
169
|
-
rack (>= 1.1)
|
|
170
|
-
rubocop (>= 0.90.0, < 2.0)
|
|
171
|
-
rubocop-rspec (1.44.1)
|
|
172
|
-
rubocop (~> 0.87)
|
|
173
|
-
rubocop-ast (>= 0.7.1)
|
|
174
|
-
ruby-progressbar (1.11.0)
|
|
175
|
-
ruby2_keywords (0.0.4)
|
|
176
|
-
sawyer (0.8.2)
|
|
177
|
-
addressable (>= 2.3.5)
|
|
178
|
-
faraday (> 0.8, < 2.0)
|
|
179
|
-
spoon (0.0.6)
|
|
180
|
-
ffi
|
|
181
|
-
terminal-table (1.8.0)
|
|
182
|
-
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
183
|
-
thread_safe (0.3.6)
|
|
184
|
-
thread_safe (0.3.6-java)
|
|
185
|
-
tzinfo (2.0.4)
|
|
186
|
-
concurrent-ruby (~> 1.0)
|
|
187
|
-
unicode-display_width (1.7.0)
|
|
188
|
-
unparser (0.4.7)
|
|
189
|
-
abstract_type (~> 0.0.7)
|
|
190
|
-
adamantium (~> 0.2.0)
|
|
191
|
-
concord (~> 0.1.5)
|
|
192
|
-
diff-lcs (~> 1.3)
|
|
193
|
-
equalizer (~> 0.0.9)
|
|
194
|
-
parser (>= 2.6.5)
|
|
195
|
-
procto (~> 0.0.2)
|
|
196
|
-
zeitwerk (2.4.2)
|
|
197
|
-
|
|
198
|
-
PLATFORMS
|
|
199
|
-
ruby
|
|
200
|
-
universal-java-1.8
|
|
201
|
-
|
|
202
|
-
DEPENDENCIES
|
|
203
|
-
benchmark
|
|
204
|
-
declarative_policy!
|
|
205
|
-
gitlab-dangerfiles (~> 1.1.0)
|
|
206
|
-
gitlab-styles (~> 6.1.0)
|
|
207
|
-
pry-byebug
|
|
208
|
-
rake (~> 12.0)
|
|
209
|
-
rspec (~> 3.10)
|
|
210
|
-
rspec-parameterized
|
|
211
|
-
rubocop
|
|
212
|
-
|
|
213
|
-
BUNDLED WITH
|
|
214
|
-
2.2.15
|
data/Rakefile
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby -w
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require 'declarative_policy'
|
|
5
|
-
require 'benchmark'
|
|
6
|
-
|
|
7
|
-
Dir["./spec/support/policies/*.rb"].sort.each { |f| require f }
|
|
8
|
-
Dir["./spec/support/models/*.rb"].sort.each { |f| require f }
|
|
9
|
-
|
|
10
|
-
TIMES = 1_000_000
|
|
11
|
-
LABEL = 'allowed?(driver, :drive_vehicle, car)'
|
|
12
|
-
|
|
13
|
-
DeclarativePolicy.configure! do
|
|
14
|
-
named_policy :global, GlobalPolicy
|
|
15
|
-
|
|
16
|
-
name_transformation do |name|
|
|
17
|
-
'ReadmePolicy' if name == 'Vehicle'
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
Benchmark.bm(LABEL.length) do |b|
|
|
22
|
-
cache = {}
|
|
23
|
-
valid_license = License.valid
|
|
24
|
-
country = Country.moderate
|
|
25
|
-
registration = Registration.new(number: 'xyz123', country: country)
|
|
26
|
-
driver = User.new(name: 'The driver', driving_license: valid_license)
|
|
27
|
-
owner = User.new(name: 'The Owner', trusted: [driver.name])
|
|
28
|
-
car = Vehicle.new(owner: owner, registration: registration)
|
|
29
|
-
|
|
30
|
-
raise 'Expected to drive' unless DeclarativePolicy.policy_for(driver, car).allowed?(:drive_vehicle)
|
|
31
|
-
|
|
32
|
-
b.report LABEL do
|
|
33
|
-
TIMES.times do
|
|
34
|
-
DeclarativePolicy.policy_for(driver, car, cache: cache).allowed?(:drive_vehicle)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Danger
|
|
4
|
-
# Project specific configuration
|
|
5
|
-
class ProjectHelper < ::Danger::Plugin
|
|
6
|
-
LOCAL_RULES ||= %w[
|
|
7
|
-
changelog
|
|
8
|
-
documentation
|
|
9
|
-
].freeze
|
|
10
|
-
|
|
11
|
-
CI_ONLY_RULES ||= %w[
|
|
12
|
-
roulette
|
|
13
|
-
].freeze
|
|
14
|
-
|
|
15
|
-
MESSAGE_PREFIX = '==>'
|
|
16
|
-
|
|
17
|
-
# First-match win, so be sure to put more specific regex at the top...
|
|
18
|
-
# rubocop: disable Style/RegexpLiteral
|
|
19
|
-
CATEGORIES = {
|
|
20
|
-
%r{\A(\.gitlab-ci\.yml\z|\.gitlab/ci)} => :engineering_productivity,
|
|
21
|
-
%r{\Alefthook.yml\z} => :engineering_productivity,
|
|
22
|
-
%r{\A\.editorconfig\z} => :engineering_productivity,
|
|
23
|
-
%r{Dangerfile\z} => :engineering_productivity,
|
|
24
|
-
%r{\A(danger/|tooling/danger/)} => :engineering_productivity,
|
|
25
|
-
%r{\A?scripts/} => :engineering_productivity,
|
|
26
|
-
%r{\Atooling/} => :engineering_productivity,
|
|
27
|
-
%r{(CODEOWNERS)} => :engineering_productivity,
|
|
28
|
-
%r{\A(Gemfile|Gemfile.lock|Rakefile)\z} => :backend,
|
|
29
|
-
%r{\A\.rubocop((_manual)?_todo)?\.yml\z} => :backend,
|
|
30
|
-
%r{\.rb\z} => :backend,
|
|
31
|
-
%r{(
|
|
32
|
-
\.(md|txt)\z |
|
|
33
|
-
\.markdownlint\.json
|
|
34
|
-
)}x => :docs
|
|
35
|
-
}.freeze
|
|
36
|
-
# rubocop: enable Style/RegexpLiteral
|
|
37
|
-
|
|
38
|
-
def changes_by_category
|
|
39
|
-
helper.changes_by_category(CATEGORIES)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def changes
|
|
43
|
-
helper.changes(CATEGORIES)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def rule_names
|
|
47
|
-
helper.ci? ? LOCAL_RULES | CI_ONLY_RULES : LOCAL_RULES
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def project_name
|
|
51
|
-
# 'declarative-policy'
|
|
52
|
-
# TODO: roulette uses the project name to find reviewers, but the gitlab team
|
|
53
|
-
# directory currently does not have any team members assigned to the declarative-policy
|
|
54
|
-
# project. We thus are piggybacking on 'gitlab' for now.
|
|
55
|
-
'gitlab'
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|