glia-errors 0.11.11 → 0.12.0

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: 171865a0d5dbbd2469f022baecf691da4593a50765bbd6032b64641316208d93
4
- data.tar.gz: 4f5520230499c9cdb90ec3276c6092408b04f3d9b3a3574d72100504f6d0d653
3
+ metadata.gz: 2a2c74c904931658ed3873ae51474edddcb93b0110129cfa7e70bb4c4894ffc8
4
+ data.tar.gz: 377d265f4e0772363bfbbac4fc4be97ba925d99afe78ba458ef72f1329e79fad
5
5
  SHA512:
6
- metadata.gz: a86c2deacb6b53bb3af9701fd2eebe946a11537560dca47230c0b521653e162bf5d452a1d245a8d6d7c12b98a1ebe6d0e290a6de324841d3f476242542b180b3
7
- data.tar.gz: cfde2dbd2c1cc7c973c3b9c335dc536e314619844835abe199b2c49f3e1ef6361185ef5bbca7a05ef3e4fe8899df62be08f2d0d7492de66b518d1db11c2c3482
6
+ metadata.gz: c3d8c4ad7aaf500b3d3cc056d7166b0f41ec184a452a11d1f89c28f1d518bbdfe79386ec1c796d5254486b968f81336a638343f913c6c313a872a72f31da1f80
7
+ data.tar.gz: 67833dced10d66343315259b86de96565e583295295352caac505e488555d101d1a1daa82c95476b6158bcf80972f3a8edf9ac537e4d7992190ec19dd89c1178
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
+ gem 'dry-validation', '~> 1.8'
7
8
  gem 'prettier', '~> 0.22'
8
9
  gem 'rake', '~> 13.0'
9
10
  gem 'rspec', '~> 3.10'
@@ -11,9 +12,3 @@ gem 'rubocop', '~> 1.5'
11
12
  gem 'rubocop-rake', '~> 0.5'
12
13
  gem 'rubocop-rspec', '~> 2.0'
13
14
  gem 'super_diff'
14
-
15
- group :test do
16
- gem 'appraisal'
17
- end
18
-
19
- gem 'dry-validation', '~> 1.8'
data/Gemfile.lock CHANGED
@@ -6,10 +6,6 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- appraisal (2.3.0)
10
- bundler
11
- rake
12
- thor (>= 0.14.0)
13
9
  ast (2.4.2)
14
10
  attr_extras (6.2.5)
15
11
  concurrent-ruby (1.1.10)
@@ -90,7 +86,6 @@ GEM
90
86
  attr_extras (>= 6.2.4)
91
87
  diff-lcs
92
88
  patience_diff
93
- thor (1.0.1)
94
89
  unicode-display_width (2.1.0)
95
90
 
96
91
  PLATFORMS
@@ -98,7 +93,6 @@ PLATFORMS
98
93
  x86_64-darwin-19
99
94
 
100
95
  DEPENDENCIES
101
- appraisal
102
96
  dry-validation (~> 1.8)
103
97
  glia-errors!
104
98
  prettier (~> 0.22)
data/README.md CHANGED
@@ -31,9 +31,7 @@ glia_error = Glia::Errors::ResourceNotFoundError.new(resource: :engagement)
31
31
 
32
32
  #### Create Glia error from `dry-validation` result
33
33
 
34
- Currently 2 `dry-validation` versions are supported:
35
- * `v0` up to `0.13`
36
- * `v1` up to `1.8`
34
+ Supports `dry-validation` from `1.6.x` to `1.8.x`
37
35
 
38
36
  ```ruby
39
37
  schema = Dry::Validation.Schema do
@@ -115,27 +113,10 @@ A Github Action will push the `.gem` file to [rubygems.org](https://rubygems.org
115
113
 
116
114
  ### Testing
117
115
 
118
- Glia errors support multiple versions of `dry-validation` and tests are run against each supported major version.
119
- Under the hood we use `Appraisal` gem which generals additional gemfiles for each of the versions.
120
-
121
- To run all tests use:
122
-
123
116
  ```
124
117
  bundle exec rake test
125
118
  ```
126
119
 
127
- To run tests only for `dry-validation` v1:
128
-
129
- ```
130
- bundle exec rake test_dry_validation_v1
131
- ```
132
-
133
- To run tests only for `dry-validation` v0:
134
-
135
- ```
136
- bundle exec rake test_dry_validation_v0
137
- ```
138
-
139
120
  ### Formatting
140
121
 
141
122
  ```
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ RuboCop::RakeTask.new do |task|
11
11
  task.requires << 'rubocop-rspec'
12
12
  end
13
13
 
14
- task default: %i[lint test]
14
+ task default: %i[lint spec]
15
15
 
16
16
  task :lint do
17
17
  sh "rubocop && rbprettier --check '**/*.rb'"
@@ -20,26 +20,3 @@ end
20
20
  task :format do
21
21
  sh "rbprettier --write '**/*.rb'"
22
22
  end
23
-
24
- task :install_test_deps do
25
- sh 'bundle exec appraisal install'
26
- end
27
-
28
- ruby_major_version = RUBY_VERSION.split('.').first.to_i
29
-
30
- # dry-validation 0.x won't load in Ruby 3
31
- if ruby_major_version < 3
32
- task test: %i[test_dry_validation_v1 test_dry_validation_v0]
33
- else
34
- task test: :test_dry_validation_v1
35
- end
36
-
37
- task test_dry_validation_v1: :install_test_deps do
38
- sh 'bundle exec appraisal dry_validation_v1 rspec'
39
- end
40
-
41
- if ruby_major_version < 3
42
- task test_dry_validation_v0: :install_test_deps do
43
- sh 'bundle exec appraisal dry_validation_v0 rspec --tag dry_validation_v0'
44
- end
45
- end
data/glia-errors.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'glia-errors'
8
- spec.version = '0.11.11'
8
+ spec.version = '0.12.0'
9
9
  spec.authors = ['Glia TechMovers']
10
10
  spec.email = ['techmovers@glia.com']
11
11
 
data/lib/glia/errors.rb CHANGED
@@ -11,13 +11,14 @@ module Glia
11
11
  module Errors
12
12
  def self.from_dry_validation_result(result, custom_error_map = {})
13
13
  dry_validation_version = Gem.loaded_specs['dry-validation'].version
14
- if dry_validation_version < Gem::Version.new('1.0')
15
- Mapper.from_dry_validation_result(result.output, result.errors, custom_error_map)
16
- elsif dry_validation_version <= Gem::Version.new('2.0')
17
- Mapper.from_dry_validation_result(result.to_h, result.errors.to_h, custom_error_map)
18
- else
14
+
15
+ # When updating supported version ensure that if new version contains new dry-validation new validations
16
+ # that they are correctly mapped to Glia errors in mapper.rb
17
+ unless dry_validation_version >= Gem::Version.new('1.0') && dry_validation_version < Gem::Version.new('1.9')
19
18
  raise 'Unsupported dry-validation version'
20
19
  end
20
+
21
+ Mapper.from_dry_validation_result(result.to_h, result.errors.to_h, custom_error_map)
21
22
  end
22
23
  end
23
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glia-errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.11
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-11 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email:
@@ -24,13 +24,10 @@ files:
24
24
  - ".rubocop.yml"
25
25
  - ".ruby-version"
26
26
  - ".travis.yml"
27
- - Appraisals
28
27
  - Gemfile
29
28
  - Gemfile.lock
30
29
  - README.md
31
30
  - Rakefile
32
- - gemfiles/dry_validation_v0.gemfile
33
- - gemfiles/dry_validation_v1.gemfile
34
31
  - glia-errors.gemspec
35
32
  - lib/glia/errors.rb
36
33
  - lib/glia/errors/client_errors.rb
data/Appraisals DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ruby_major_version = RUBY_VERSION.split('.').first.to_i
4
-
5
- if ruby_major_version < 3
6
- appraise 'dry_validation_v0' do
7
- gem 'dry-container', '~> 0.8.0'
8
- gem 'dry-core', '~> 0.5.0'
9
- gem 'dry-validation', '~> 0.13.0'
10
- end
11
- end
12
-
13
- appraise 'dry_validation_v1' do
14
- gem 'dry-validation', '~> 1.8'
15
- end
@@ -1,20 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "prettier", "~> 0.22"
6
- gem "rake", "~> 13.0"
7
- gem "rspec", "~> 3.10"
8
- gem "rubocop", "~> 1.5"
9
- gem "rubocop-rake", "~> 0.5"
10
- gem "rubocop-rspec", "~> 2.0"
11
- gem "super_diff"
12
- gem "dry-validation", "~> 0.13.0"
13
- gem "dry-container", "~> 0.8.0"
14
- gem "dry-core", "~> 0.5.0"
15
-
16
- group :test do
17
- gem "appraisal"
18
- end
19
-
20
- gemspec path: "../"
@@ -1,18 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "prettier", "~> 0.22"
6
- gem "rake", "~> 13.0"
7
- gem "rspec", "~> 3.10"
8
- gem "rubocop", "~> 1.5"
9
- gem "rubocop-rake", "~> 0.5"
10
- gem "rubocop-rspec", "~> 2.0"
11
- gem "super_diff"
12
- gem "dry-validation", "~> 1.8"
13
-
14
- group :test do
15
- gem "appraisal"
16
- end
17
-
18
- gemspec path: "../"