hanami-validations 1.3.6 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8dae242dc04bc7ff5f72ed33253dd86e994ce5fd3a52575821be95a0ef30269
4
- data.tar.gz: 73c0688c96f1f37a4ac0404c8823d0a26d0bb30aa3e8fb39da8a416145707294
3
+ metadata.gz: d1f7b53f0322c8691f0b9a90d589ac6761a04af957b5f3549571617105399131
4
+ data.tar.gz: 8fb7a92a0552db6db2ddf5c883385e99c89dce54948611396791da341a9b402d
5
5
  SHA512:
6
- metadata.gz: 66eb97d7a6c027a54ffc1617e8e61763e1ef6574c03c4387a925e07a20f6be07222bc35b17af7976d51b2bd36c3ed7bcc306bde33aa67a61e51a1bbb6156e984
7
- data.tar.gz: ec18cd2ff3c59b38902bc52d85fab6dfb48a2c7dada4fd9ef06b135bb2907cd03d7814293ca8029b9ee576481930a1276489b946877e7522293a1cd47e1a1174
6
+ metadata.gz: b6e82c5299d26c4937f87f253991f0007e730f7f243ca6a69ee43df8d85dda6f399a56dad3e3a9a95265ecbe58e42533747672d93c142985a18b76010c2eee83
7
+ data.tar.gz: b2e3f208d4649541ed63290d6da7c7f1dfbe1e4ab7f3e6d4d975ed3374d8b350c23fc8fe97d0a31aee85d7ef42c094f88c8297c22ea7a104ca6ff17c08009e48
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Hanami::Validations
2
2
  Validations mixin for Ruby objects
3
3
 
4
+ ## v1.3.9 - 2022-07-21
5
+ ### Fixed
6
+ - [Sean Collins] Depend on `dry-container` `<= 0.9`
7
+
8
+ ## v1.3.8 - 2021-10-14
9
+ ### Fixed
10
+ - [Luca Guidi] Ensure `.validations` to not raise `NoMethodError: undefined method 'size' for nil:NilClass`. Due to a breaking change in transitive dependency (`dry-configurable` `0.13.x`).
11
+
12
+ ## v1.3.7 - 2021-01-06
13
+ ### Fixed
14
+ - [Panagiotis Matsinopoulos] Ensure `predicate` and `predicates` to work together
15
+
4
16
  ## v1.3.6 - 2020-01-08
5
17
  ### Added
6
18
  - [Luca Guidi] Official support for Ruby: MRI 2.7
data/README.md CHANGED
@@ -2,12 +2,15 @@
2
2
 
3
3
  Validations mixin for Ruby objects
4
4
 
5
+ ## Version
6
+
7
+ **This branch contains the code for `hanami-validations` 1.3.x.**
8
+
5
9
  ## Status
6
10
 
7
11
  [![Gem Version](https://badge.fury.io/rb/hanami-validations.svg)](https://badge.fury.io/rb/hanami-validations)
8
- [![Build Status](https://ci.hanamirb.org/api/badges/hanami/validations/status.svg)](https://ci.hanamirb.org/hanami/validations)
9
- [![CircleCI](https://circleci.com/gh/hanami/validations/tree/master.svg?style=svg)](https://circleci.com/gh/hanami/validations/tree/master)
10
- [![Test Coverage](https://codecov.io/gh/hanami/validations/branch/master/graph/badge.svg)](https://codecov.io/gh/hanami/validations)
12
+ [![CI](https://github.com/hanami/validations/workflows/ci/badge.svg?branch=1.3.x)](https://github.com/hanami/validations/actions?query=workflow%3Aci+branch%3A1.3.x)
13
+ [![Test Coverage](https://codecov.io/gh/hanami/validations/branch/1.3.x/graph/badge.svg)](https://codecov.io/gh/hanami/validations)
11
14
  [![Depfu](https://badges.depfu.com/badges/af6c6be539d9d587c7541ae7a013c9ff/overview.svg)](https://depfu.com/github/hanami/validations?project=Bundler)
12
15
  [![Inline Docs](http://inch-ci.org/github/hanami/validations.svg)](http://inch-ci.org/github/hanami/validations)
13
16
 
@@ -800,6 +803,6 @@ Thanks to [dry-rb](http://dry-rb.org) Community for their priceless support. ❤
800
803
 
801
804
  ## Copyright
802
805
 
803
- Copyright © 2014-2017 Luca Guidi – Released under MIT License
806
+ Copyright © 2014-2021 Luca Guidi – Released under MIT License
804
807
 
805
808
  This project was formerly known as Lotus (`lotus-validations`).
@@ -1,28 +1,33 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'hanami/validations/version'
5
+ require "hanami/validations/version"
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = 'hanami-validations'
8
+ spec.name = "hanami-validations"
7
9
  spec.version = Hanami::Validations::VERSION
8
- spec.authors = ['Luca Guidi']
9
- spec.email = ['me@lucaguidi.com']
10
- spec.summary = 'Validations mixin for Ruby objects'
11
- spec.description = 'Validations mixin for Ruby objects and support for Hanami'
12
- spec.homepage = 'http://hanamirb.org'
13
- spec.license = 'MIT'
10
+ spec.authors = ["Luca Guidi"]
11
+ spec.email = ["me@lucaguidi.com"]
12
+ spec.summary = "Validations mixin for Ruby objects"
13
+ spec.description = "Validations mixin for Ruby objects and support for Hanami"
14
+ spec.homepage = "http://hanamirb.org"
15
+ spec.license = "MIT"
14
16
 
15
- spec.files = `git ls-files -- lib/* LICENSE.md README.md CHANGELOG.md hanami-validations.gemspec`.split($INPUT_RECORD_SEPARATOR)
17
+ spec.files = `git ls-files -- lib/* LICENSE.md README.md CHANGELOG.md hanami-validations.gemspec`.split($/)
16
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ['lib']
19
- spec.required_ruby_version = '>= 2.3.0'
20
+ spec.require_paths = ["lib"]
21
+ spec.required_ruby_version = ">= 2.3.0"
20
22
 
21
- spec.add_dependency 'hanami-utils', '~> 1.3'
22
- spec.add_dependency 'dry-validation', '~> 0.11', '< 0.12'
23
- spec.add_dependency 'dry-logic', '~> 0.4.2', '< 0.5'
23
+ spec.add_dependency "hanami-utils", "~> 1.3"
24
+ spec.add_dependency "dry-validation", "~> 0.11", "< 0.12"
25
+ spec.add_dependency "dry-logic", "~> 0.4.2", "< 0.5"
26
+ spec.add_dependency "dry-configurable", "<= 0.12"
27
+ spec.add_dependency "dry-container", "<= 0.9"
24
28
 
25
- spec.add_development_dependency 'bundler', '>= 1.6', '< 3'
26
- spec.add_development_dependency 'rake', '~> 13'
27
- spec.add_development_dependency 'rspec', '~> 3.7'
29
+ spec.add_development_dependency "bundler", ">= 1.6", "< 3"
30
+ spec.add_development_dependency "rake", "~> 13"
31
+ spec.add_development_dependency "rspec", "~> 3.9"
32
+ spec.add_development_dependency "rubocop", "0.81" # rubocop 0.81+ removed support for Ruby 2.3
28
33
  end
@@ -1,4 +1,6 @@
1
- require 'hanami/validations'
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/validations"
2
4
 
3
5
  module Hanami
4
6
  module Validations
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hanami
2
4
  module Validations
3
5
  # Inline predicate
@@ -1,4 +1,6 @@
1
- require 'hanami/utils/string'
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/utils/string"
2
4
 
3
5
  module Hanami
4
6
  module Validations
@@ -12,19 +14,19 @@ module Hanami
12
14
  class Namespace
13
15
  # @since 0.6.0
14
16
  # @api private
15
- SUFFIX = 'Validator'.freeze
17
+ SUFFIX = "Validator"
16
18
 
17
19
  # @since 0.6.0
18
20
  # @api private
19
- SUFFIX_REPLACEMENT = ''.freeze
21
+ SUFFIX_REPLACEMENT = ""
20
22
 
21
23
  # @since 0.6.0
22
24
  # @api private
23
- RUBY_NAMESPACE_SEPARATOR = '/'.freeze
25
+ RUBY_NAMESPACE_SEPARATOR = "/"
24
26
 
25
27
  # @since 0.6.0
26
28
  # @api private
27
- RUBY_NAMESPACE_REPLACEMENT = '.'.freeze
29
+ RUBY_NAMESPACE_REPLACEMENT = "."
28
30
 
29
31
  # @since 0.6.0
30
32
  # @api private
@@ -1,5 +1,7 @@
1
- require 'dry/logic/predicates'
2
- require 'hanami/utils/class_attribute'
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/logic/predicates"
4
+ require "hanami/utils/class_attribute"
3
5
 
4
6
  module Hanami
5
7
  module Validations
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hanami
2
4
  module Validations
3
5
  # @since 0.1.0
4
- VERSION = '1.3.6'.freeze
6
+ VERSION = "1.3.9"
5
7
  end
6
8
  end
@@ -1,9 +1,11 @@
1
- require 'dry-validation'
2
- require 'hanami/utils/class_attribute'
3
- require 'hanami/validations/namespace'
4
- require 'hanami/validations/predicates'
5
- require 'hanami/validations/inline_predicate'
6
- require 'set'
1
+ # frozen_string_literal: true
2
+
3
+ require "dry-validation"
4
+ require "hanami/utils/class_attribute"
5
+ require "hanami/validations/namespace"
6
+ require "hanami/validations/predicates"
7
+ require "hanami/validations/inline_predicate"
8
+ require "set"
7
9
 
8
10
  Dry::Validation::Messages::Namespaced.configure do |config|
9
11
  # rubocop:disable Lint/NestedPercentLiteral
@@ -45,7 +47,7 @@ module Hanami
45
47
  # @api private
46
48
  #
47
49
  # @see http://www.ruby-doc.org/core/Module.html#method-i-included
48
- def self.included(base) # rubocop:disable Metrics/MethodLength
50
+ def self.included(base)
49
51
  base.class_eval do
50
52
  extend ClassMethods
51
53
 
@@ -95,8 +97,8 @@ module Hanami
95
97
  # result.success? # => false
96
98
  # result.messages # => {:name=>["must be filled"]}
97
99
  # result.output # => {:name=>""}
98
- def validations(&blk) # rubocop:disable Metrics/AbcSize
99
- schema_predicates = _predicates_module || __predicates
100
+ def validations(&blk)
101
+ schema_predicates = __predicates
100
102
 
101
103
  base = _build(predicates: schema_predicates, &_base_rules)
102
104
  schema = _build(predicates: schema_predicates, rules: base.rules, &blk)
@@ -152,7 +154,7 @@ module Hanami
152
154
  #
153
155
  # result = Signup.new(name: nil).call
154
156
  # result.messages # => { :name => ['must be foo'] }
155
- def predicate(name, message: 'is invalid', &blk)
157
+ def predicate(name, message: "is invalid", &blk)
156
158
  _predicates << InlinePredicate.new(name, message, &blk)
157
159
  end
158
160
 
@@ -261,7 +263,7 @@ module Hanami
261
263
  # @since 0.6.0
262
264
  # @api private
263
265
  def _build(options = {}, &blk)
264
- options = { build: false }.merge(options)
266
+ options = {build: false}.merge(options)
265
267
  Dry::Validation.__send__(_schema_type, options, &blk)
266
268
  end
267
269
 
@@ -292,7 +294,7 @@ module Hanami
292
294
 
293
295
  # @since 0.6.0
294
296
  # @api private
295
- def _schema_predicates # rubocop:disable Metrics/CyclomaticComplexity
297
+ def _schema_predicates
296
298
  return if _predicates_module.nil? && _predicates.empty?
297
299
 
298
300
  lambda do |config|
@@ -306,7 +308,7 @@ module Hanami
306
308
  # @since 0.6.0
307
309
  # @api private
308
310
  def __predicates
309
- mod = Module.new { include Hanami::Validations::Predicates }
311
+ mod = _predicates_module || Module.new { include Hanami::Validations::Predicates }
310
312
 
311
313
  _predicates.each do |p|
312
314
  mod.module_eval do
@@ -319,7 +321,7 @@ module Hanami
319
321
 
320
322
  # @since 0.6.0
321
323
  # @api private
322
- def __messages # rubocop:disable Metrics/MethodLength
324
+ def __messages
323
325
  result = _predicates.each_with_object({}) do |p, ret|
324
326
  ret[p.name] = p.message
325
327
  end
@@ -332,7 +334,7 @@ module Hanami
332
334
  def self.extended(base)
333
335
  base.instance_eval do
334
336
  def __messages
335
- Hash[en: { errors: @@__messages }]
337
+ Hash[en: {errors: @@__messages}]
336
338
  end
337
339
  end
338
340
  end
@@ -1 +1,3 @@
1
- require 'hanami/validations'
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami/validations"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-08 00:00:00.000000000 Z
11
+ date: 2022-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hanami-utils
@@ -64,6 +64,34 @@ dependencies:
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0.5'
67
+ - !ruby/object:Gem::Dependency
68
+ name: dry-configurable
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "<="
72
+ - !ruby/object:Gem::Version
73
+ version: '0.12'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "<="
79
+ - !ruby/object:Gem::Version
80
+ version: '0.12'
81
+ - !ruby/object:Gem::Dependency
82
+ name: dry-container
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "<="
86
+ - !ruby/object:Gem::Version
87
+ version: '0.9'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "<="
93
+ - !ruby/object:Gem::Version
94
+ version: '0.9'
67
95
  - !ruby/object:Gem::Dependency
68
96
  name: bundler
69
97
  requirement: !ruby/object:Gem::Requirement
@@ -104,14 +132,28 @@ dependencies:
104
132
  requirements:
105
133
  - - "~>"
106
134
  - !ruby/object:Gem::Version
107
- version: '3.7'
135
+ version: '3.9'
108
136
  type: :development
109
137
  prerelease: false
110
138
  version_requirements: !ruby/object:Gem::Requirement
111
139
  requirements:
112
140
  - - "~>"
113
141
  - !ruby/object:Gem::Version
114
- version: '3.7'
142
+ version: '3.9'
143
+ - !ruby/object:Gem::Dependency
144
+ name: rubocop
145
+ requirement: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - '='
148
+ - !ruby/object:Gem::Version
149
+ version: '0.81'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - '='
155
+ - !ruby/object:Gem::Version
156
+ version: '0.81'
115
157
  description: Validations mixin for Ruby objects and support for Hanami
116
158
  email:
117
159
  - me@lucaguidi.com
@@ -134,7 +176,7 @@ homepage: http://hanamirb.org
134
176
  licenses:
135
177
  - MIT
136
178
  metadata: {}
137
- post_install_message:
179
+ post_install_message:
138
180
  rdoc_options: []
139
181
  require_paths:
140
182
  - lib
@@ -149,8 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
191
  - !ruby/object:Gem::Version
150
192
  version: '0'
151
193
  requirements: []
152
- rubygems_version: 3.1.2
153
- signing_key:
194
+ rubygems_version: 3.3.7
195
+ signing_key:
154
196
  specification_version: 4
155
197
  summary: Validations mixin for Ruby objects
156
198
  test_files: []