pragma-contract 2.0.0 → 2.0.1

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
- SHA1:
3
- metadata.gz: 662694b3635eb7a13110e1704914cccff1b57aa5
4
- data.tar.gz: 996a5b17c73f47ea46732e51e1465df0e6feb50d
2
+ SHA256:
3
+ metadata.gz: 65bb088e2e5f2bea1013369379af3335d4c02b381775d376701c0453b8e8f17c
4
+ data.tar.gz: e2bca105d4a8cc7c3980c8f927bea2468b33a5d342ace9574f5e41afb0a8fc04
5
5
  SHA512:
6
- metadata.gz: de3a06fa0917e9172eaf150b752c829c7fbffc52641e00816b97b9e40c51c4ac9912ae3611af77bd39fd150488e3eff932c9533b221f719f661beecf6e942dce
7
- data.tar.gz: 4611ed1f0ae41f68ad98831fdee4824d80aa7ea2d5bf6e923d5960b180d9e47592b9049fd7e9161c6127fb69ec38800e41c4a0a270e585f5c64b69ba868ad3ed
6
+ metadata.gz: c9a7cf260d36af1a576d4fa6f16c913b0a643dc4ec67a735a5760213efde02ccd94223b35a43ff601b72755d393a8045402e0ad03281c339c78aa4b93c3fcf36
7
+ data.tar.gz: 07afc3dcc218d6f3208b18f28456327ea7a9850452c41cae0c96f9022a4c4cfe68a6b0808d436cb37651bc60462f17a7601131ae2e80527b7d8ef8c57428645f
@@ -52,7 +52,7 @@ Style/SignalException:
52
52
  Style/BracesAroundHashParameters:
53
53
  EnforcedStyle: context_dependent
54
54
 
55
- Lint/EndAlignment:
55
+ Layout/EndAlignment:
56
56
  EnforcedStyleAlignWith: variable
57
57
  AutoCorrect: true
58
58
 
@@ -74,6 +74,6 @@ Metrics/BlockLength:
74
74
  Style/Documentation:
75
75
  Enabled: false
76
76
 
77
- Style/FileName:
77
+ Naming/FileName:
78
78
  Exclude:
79
79
  - '*.gemspec'
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.0.1]
11
+
12
+ ### Fixed
13
+
14
+ - Added forwards compatibility with Dry::Types 0.13
15
+ - Locked Dry::Types to 0.12.x for compatibility with Dry::Validation
16
+ - Locked Dry::Validation to 0.11.x to prevent error with Dry::Validation.Form not being available
17
+
18
+ ### Changed
19
+
20
+ - `Pragma::Contract::Coercion` is now loaded with `feature`
21
+
22
+ ## [2.0.0]
23
+
24
+ First Pragma 2 release.
25
+
26
+ [Unreleased]: https://github.com/pragmarb/pragma-contract/compare/v2.0.1...HEAD
27
+ [2.0.1]: https://github.com/pragmarb/pragma-contract/compare/v2.0.0...v2.0.1
28
+ [2.0.0]: https://github.com/pragmarb/pragma-contract/compare/v0.1.0...v2.0.0
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # Pragma::Contract
2
2
 
3
- [![Build Status](https://img.shields.io/travis/pragmarb/pragma-contract.svg?maxAge=3600&style=flat-square)](https://travis-ci.org/pragmarb/pragma-contract)
4
- [![Dependency Status](https://img.shields.io/gemnasium/pragmarb/pragma-contract.svg?maxAge=3600&style=flat-square)](https://gemnasium.com/github.com/pragmarb/pragma-contract)
5
- [![Code Climate](https://img.shields.io/codeclimate/github/pragmarb/pragma-contract.svg?maxAge=3600&style=flat-square)](https://codeclimate.com/github/pragmarb/pragma-contract)
6
- [![Coveralls](https://img.shields.io/coveralls/pragmarb/pragma-contract.svg?maxAge=3600&style=flat-square)](https://coveralls.io/github/pragmarb/pragma-contract)
3
+ [![Build Status](https://travis-ci.org/pragmarb/pragma-contract.svg?branch=master)](https://travis-ci.org/pragmarb/pragma-contract)
4
+ [![Coverage Status](https://coveralls.io/repos/github/pragmarb/pragma-contract/badge.svg?branch=master)](https://coveralls.io/github/pragmarb/pragma-contract?branch=master)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/e51e8d7489eb72ab97ba/maintainability)](https://codeclimate.com/github/pragmarb/pragma-contract/maintainability)
7
6
 
8
7
  Contracts are form objects on steroids for your JSON API.
9
8
 
@@ -12,8 +12,8 @@ module Pragma
12
12
  # @author Alessandro Desantis
13
13
  class Base < Reform::Form
14
14
  feature Reform::Form::Coercion
15
+ feature Pragma::Contract::Coercion
15
16
  feature Reform::Form::Dry
16
- include Pragma::Contract::Coercion
17
17
 
18
18
  property :current_user, virtual: true
19
19
  end
@@ -8,19 +8,6 @@ module Pragma
8
8
  end
9
9
 
10
10
  module ClassMethods
11
- def property(*args, &block)
12
- if block_given?
13
- super(*args) do
14
- include Pragma::Contract::Coercion
15
- instance_eval(&block)
16
- end
17
- else
18
- super(*args)
19
- end
20
- end
21
-
22
- private
23
-
24
11
  def strict(type)
25
12
  build_type 'Strict', type
26
13
  end
@@ -30,7 +17,13 @@ module Pragma
30
17
  end
31
18
 
32
19
  def form(type)
33
- build_type 'Form', type
20
+ # Dry::Types 0.13 renames Types::Form to Types::Params and the Int type to Integer.
21
+
22
+ if Dry::Types['form.int']
23
+ build_type 'Form', type
24
+ else
25
+ build_type 'Params', type.to_sym == :int ? :integer : type
26
+ end
34
27
  end
35
28
 
36
29
  def json(type)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pragma
4
4
  module Contract
5
- VERSION = '2.0.0'
5
+ VERSION = '2.0.1'
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'pragma/contract/version'
6
6
 
@@ -21,14 +21,14 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
+ spec.add_dependency 'dry-types', '~> 0.12.0'
25
+ spec.add_dependency 'dry-validation', '~> 0.11.1'
24
26
  spec.add_dependency 'reform', '~> 2.2'
25
- spec.add_dependency 'dry-types', '~> 0.9'
26
- spec.add_dependency 'dry-validation', '~> 0.10'
27
27
 
28
28
  spec.add_development_dependency 'bundler'
29
+ spec.add_development_dependency 'coveralls'
29
30
  spec.add_development_dependency 'rake'
30
31
  spec.add_development_dependency 'rspec'
31
32
  spec.add_development_dependency 'rubocop'
32
33
  spec.add_development_dependency 'rubocop-rspec'
33
- spec.add_development_dependency 'coveralls'
34
34
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragma-contract
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2018-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: reform
14
+ name: dry-types
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.2'
19
+ version: 0.12.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: '2.2'
26
+ version: 0.12.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: dry-types
28
+ name: dry-validation
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: 0.11.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.9'
40
+ version: 0.11.1
41
41
  - !ruby/object:Gem::Dependency
42
- name: dry-validation
42
+ name: reform
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.10'
47
+ version: '2.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.10'
54
+ version: '2.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: coveralls
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop
98
+ name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rubocop-rspec
112
+ name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: coveralls
126
+ name: rubocop-rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -147,6 +147,7 @@ files:
147
147
  - ".rspec"
148
148
  - ".rubocop.yml"
149
149
  - ".travis.yml"
150
+ - CHANGELOG.md
150
151
  - Gemfile
151
152
  - LICENSE.txt
152
153
  - README.md
@@ -179,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
180
  version: '0'
180
181
  requirements: []
181
182
  rubyforge_project:
182
- rubygems_version: 2.6.13
183
+ rubygems_version: 2.7.5
183
184
  signing_key:
184
185
  specification_version: 4
185
186
  summary: Form objects on steroids for your HTTP API.