tram-policy 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +44 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +0 -2
- data/lib/tram/policy/dsl.rb +1 -1
- data/lib/tram/policy/error.rb +1 -1
- data/lib/tram/policy/errors.rb +2 -2
- data/lib/tram/policy/rspec.rb +1 -1
- data/spec/tram/policy/error_spec.rb +1 -1
- data/tram-policy.gemspec +1 -1
- metadata +4 -4
- data/.travis.yml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee9ed362efd81c55cfe3097f6188f8da61af5b3ec78eee0eb6e5182bbfd62245
|
4
|
+
data.tar.gz: f2ab09546f5c6c5a70fca9459b1e2658dab85b0b2f9ffd27685ba61b00c62f06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ff7aaa1632158f2c5664b7bd492cd3a0f7d574f91c7232a97fb2a45b8ebdaf4923578716d805b56c66098ab4ddb7dbe2a2a506832f42d5a03c2e4128675acb4
|
7
|
+
data.tar.gz: 8d28126a3d030a3b7ff4a59e11f3444865bb634358997fd690af1117380b9001d2221b40456d2a727cd32ba2fd0ed2a03fd6eef3618caa13e3e068f5427f8da5
|
@@ -0,0 +1,44 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- "*"
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
name: Ruby ${{ matrix.ruby }}
|
14
|
+
|
15
|
+
strategy:
|
16
|
+
fail-fast: true
|
17
|
+
matrix:
|
18
|
+
ruby:
|
19
|
+
- "2.5.0"
|
20
|
+
- "3.0.0"
|
21
|
+
- "head"
|
22
|
+
|
23
|
+
runs-on: ubuntu-latest
|
24
|
+
|
25
|
+
steps:
|
26
|
+
- name: Checkout
|
27
|
+
uses: actions/checkout@v2
|
28
|
+
|
29
|
+
- name: Install dependent libraries
|
30
|
+
run: sudo apt-get install libpq-dev
|
31
|
+
|
32
|
+
- name: Install Ruby ${{ matrix.ruby }}
|
33
|
+
uses: ruby/setup-ruby@v1.61.1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
36
|
+
bundler-cache: true # 'bundle install' and cache
|
37
|
+
|
38
|
+
- name: Check code style
|
39
|
+
run: bundle exec rubocop
|
40
|
+
continue-on-error: false
|
41
|
+
|
42
|
+
- name: Run tests
|
43
|
+
run: bundle exec rake --trace
|
44
|
+
continue-on-error: false
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [2.2.0] - [2022-06-18]
|
8
|
+
|
9
|
+
### Added
|
10
|
+
- Support for Ruby 3+ (HolyWalley)
|
11
|
+
|
7
12
|
## [2.1.0] - [2021-11-30]
|
8
13
|
|
9
14
|
### Fixed
|
@@ -225,3 +230,4 @@ This is a first public release (@nepalez, @charlie-wasp, @JewelSam, @sergey-chec
|
|
225
230
|
[2.0.0]: https://github.com/tram-rb/tram-policy/compare/v1.0.1...v2.0.0
|
226
231
|
[2.0.1]: https://github.com/tram-rb/tram-policy/compare/v2.0.0...v2.0.1
|
227
232
|
[2.1.0]: https://github.com/tram-rb/tram-policy/compare/v2.0.1...v2.1.0
|
233
|
+
[2.1.0]: https://github.com/tram-rb/tram-policy/compare/v2.1.0...v2.2.0
|
data/README.md
CHANGED
@@ -6,7 +6,6 @@ Policy Object Pattern
|
|
6
6
|
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
|
7
7
|
|
8
8
|
[![Gem Version][gem-badger]][gem]
|
9
|
-
[![Build Status][travis-badger]][travis]
|
10
9
|
[![Inline docs][inch-badger]][inch]
|
11
10
|
|
12
11
|
## Intro
|
@@ -340,7 +339,6 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
340
339
|
[inch-badger]: http://inch-ci.org/github/tram-rb/tram-policy.svg
|
341
340
|
[inch]: https://inch-ci.org/github/tram-rb/tram-policy
|
342
341
|
[travis-badger]: https://img.shields.io/travis/tram-rb/tram-policy/master.svg?style=flat
|
343
|
-
[travis]: https://travis-ci.org/tram-rb/tram-policy
|
344
342
|
[active-model-validation]: http://api.rubyonrails.org/classes/ActiveModel/Validations.html
|
345
343
|
[active-record-validation]: http://guides.rubyonrails.org/active_record_validations.html
|
346
344
|
[dry-validation]: http://dry-rb.org/gems/dry-validation/
|
data/lib/tram/policy/dsl.rb
CHANGED
data/lib/tram/policy/error.rb
CHANGED
data/lib/tram/policy/errors.rb
CHANGED
@@ -47,7 +47,7 @@ class Tram::Policy
|
|
47
47
|
#
|
48
48
|
def filter(key = nil, **tags)
|
49
49
|
list = each_with_object(Set.new) do |error, obj|
|
50
|
-
obj << error if error.contain?(key, tags)
|
50
|
+
obj << error if error.contain?(key, **tags)
|
51
51
|
end
|
52
52
|
self.class.new(scope: scope, errors: list)
|
53
53
|
end
|
@@ -95,7 +95,7 @@ class Tram::Policy
|
|
95
95
|
other.each do |err|
|
96
96
|
key, opts = err.item
|
97
97
|
opts = yield(opts) if block_given?
|
98
|
-
add key, opts.merge(options)
|
98
|
+
add key, **opts.merge(options)
|
99
99
|
end
|
100
100
|
|
101
101
|
self
|
data/lib/tram/policy/rspec.rb
CHANGED
@@ -6,7 +6,7 @@ RSpec::Matchers.define :be_invalid_at do |**tags|
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def check(policy, tags)
|
9
|
-
@errors ||= policy.errors.filter(tags).map do |error|
|
9
|
+
@errors ||= policy.errors.filter(**tags).map do |error|
|
10
10
|
{ item: error.item }.tap do |obj|
|
11
11
|
locales.each { |l| obj[l] = I18n.with_locale(l) { error.message } }
|
12
12
|
end
|
data/tram-policy.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "tram-policy"
|
3
|
-
gem.version = "2.
|
3
|
+
gem.version = "2.2.0"
|
4
4
|
gem.author = ["Viktor Sokolov (gzigzigzeo)", "Andrew Kozin (nepalez)"]
|
5
5
|
gem.email = "andrew.kozin@gmail.com"
|
6
6
|
gem.homepage = "https://github.com/tram-rb/tram-policy"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tram-policy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Sokolov (gzigzigzeo)
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-initializer
|
@@ -125,10 +125,10 @@ extra_rdoc_files:
|
|
125
125
|
- CHANGELOG.md
|
126
126
|
files:
|
127
127
|
- ".codeclimate.yml"
|
128
|
+
- ".github/workflows/ci.yml"
|
128
129
|
- ".gitignore"
|
129
130
|
- ".rspec"
|
130
131
|
- ".rubocop.yml"
|
131
|
-
- ".travis.yml"
|
132
132
|
- CHANGELOG.md
|
133
133
|
- Gemfile
|
134
134
|
- LICENSE.txt
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.2.3
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Policy Object Pattern
|
data/.travis.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
sudo: false
|
4
|
-
cache: bundler
|
5
|
-
bundler_args: --without benchmarks tools
|
6
|
-
script:
|
7
|
-
- bundle exec rake
|
8
|
-
- bundle exec rubocop
|
9
|
-
rvm:
|
10
|
-
- 2.3.0
|
11
|
-
- 2.6.2
|
12
|
-
- ruby-head
|
13
|
-
- jruby-9.2.7.0
|
14
|
-
- truffleruby
|
15
|
-
env:
|
16
|
-
global:
|
17
|
-
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
18
|
-
matrix:
|
19
|
-
allow_failures:
|
20
|
-
- rvm: ruby-head
|
21
|
-
- rvm: jruby-head
|
22
|
-
- rvm: truffleruby
|