validates_zipcode 0.3.2 → 0.5.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
2
  SHA256:
3
- metadata.gz: 9d69de112628ab38fe5ec60e90d96f49601f988de22528de0de4286fcb080d56
4
- data.tar.gz: 4bddb4ac3fdb64fa8013489ee4fa6611970feb97db546e3da1a46887ef26b493
3
+ metadata.gz: df2a33cb45dafbda679e54e3030fc68c6ed9bd333f1b6333c62fd7f55d19e34a
4
+ data.tar.gz: 650da19b279aa781e6cfeb3452b9cef2f534bf8eb07a24b9d3335e803ed0c4e0
5
5
  SHA512:
6
- metadata.gz: 7fe6dfdaefe75178df3f5fdebd9841fcbd2ef6179f2565f0d6aa410ad34df62b3789b95e0318c989b404367324e176aad6e82adeccf6445766b108107f889a2c
7
- data.tar.gz: 434ea691cf005b4e3b14d406e58ac343f2ba01378fae35403c18b5a8fbf3e3276aa17fb6004bda6704e6578d8799329e441a0a0e33510ddbd712afda42fc32f5
6
+ metadata.gz: 96c289be91ec67e3bc2ae13627088b35720f61257449fd372b4dbf96decf90a95a5d24b0dff58d599632aee4f2af803f470a9352b94b2c0a0a815daec6b1197c
7
+ data.tar.gz: 4ec5b753940e0f7593249ad0090836ee778b170c5da70632069d1eceb14ec523236ced64ec221b13aaad0350e0537a82aa0c602436e9cf4706019b582670e050
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ .dccache
data/.rubocop.yml CHANGED
@@ -12,7 +12,7 @@ require:
12
12
  AllCops:
13
13
  TargetRubyVersion: 2.4
14
14
 
15
- TargetRailsVersion: 4.2
15
+ TargetRailsVersion: 5.2
16
16
 
17
17
  # Include common Ruby source files.
18
18
  Include:
@@ -862,7 +862,7 @@ Layout/DefEndAlignment:
862
862
 
863
863
  ##################### Rails ##################################
864
864
  Rails:
865
- Enabled: true
865
+ Enabled: false
866
866
 
867
867
  Rails/ActionFilter:
868
868
  EnforcedStyle: action
data/.travis.yml CHANGED
@@ -7,23 +7,26 @@ cache: bundler
7
7
  bundler_args: --jobs 3 --retry 3
8
8
 
9
9
  before_install:
10
- - 'travis_retry gem update --system'
11
- - 'travis_retry gem install bundler'
10
+ - "travis_retry gem update --system"
11
+ - "travis_retry gem install bundler"
12
12
 
13
- script: 'bundle exec rake'
13
+ script: "bundle exec rake"
14
14
 
15
15
  rvm:
16
16
  - 2.4.9
17
17
  - 2.5.7
18
18
  - 2.6.5
19
- - 2.7.0
19
+ - 2.7.2
20
+ - 3.0.0
21
+ - 3.1.2
20
22
  - ruby-head
21
23
  - truffleruby
22
24
 
23
25
  gemfile:
24
26
  - gemfiles/rails_4.2.gemfile
25
27
  - gemfiles/rails_5.2.gemfile
26
- - gemfiles/rails_6.0.gemfile
28
+ - gemfiles/rails_6.1.gemfile
29
+ - gemfiles/rails_7.0.gemfile
27
30
  - gemfiles/rails_edge.gemfile
28
31
 
29
32
  matrix:
@@ -32,6 +35,10 @@ matrix:
32
35
  - rvm: ruby-head
33
36
  exclude:
34
37
  - rvm: 2.4.9
35
- gemfile: gemfiles/rails_6.gemfile
38
+ gemfile: gemfiles/rails_6.1.gemfile
36
39
  - rvm: 2.4.9
40
+ gemfile: gemfiles/rails_7.0.gemfile
41
+ - rvm: 2.4.9
42
+ gemfile: gemfiles/rails_edge.gemfile
43
+ - rvm: 3.0.0
37
44
  gemfile: gemfiles/rails_edge.gemfile
data/Appraisals CHANGED
@@ -8,8 +8,12 @@ appraise 'rails-5.2' do
8
8
  gem 'activemodel', '~> 5.2.0'
9
9
  end
10
10
 
11
- appraise 'rails-6.0' do
12
- gem 'activemodel', '~> 5.2.0'
11
+ appraise 'rails-6.1' do
12
+ gem 'activemodel', '~> 6.1.0'
13
+ end
14
+
15
+ appraise 'rails-7.0' do
16
+ gem 'activemodel', '~> 7.0.0'
13
17
  end
14
18
 
15
19
  appraise 'rails_edge' do
data/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.5.1
6
+
7
+ - Fixes Mongolia postal codes, thanks to ~ @lucasfcunha
8
+
9
+ ## 0.5.0
10
+
11
+ - Pass `format: true` option to the `validates_zipcode` or the constructor to attempt for format a given code using the (uncomplete) list of formatters by country. This process will happen before the validation takes place, dealing with case sensitive formats and whitespace, amongst others. This option is false by default for backwards compatibility. ~ @chloe-meister
12
+ - Fixed unconsistent behaviour by which the `ValidatesZipcode.format` and `ValidatesZipcode::Formatter.new(..).format` where formatting an invalid code, the former, and raising a validity error, the latter. ~ @chloe-meister
13
+
14
+ ## 0.4.0
15
+
16
+ **HEADS UP**: While I don't think this update would break any system for anyone, many formats where revisited to make them more loose or strict, potentially rendering your data invalid, particularly in edge cases or with data that was already incorrect in the first place and not flagges as such. I recommend you check your data with the new version in case these validations are critical to you. I am not releasing this as a 1.0 because there are no breaking changes in the API though. See PR #54 for more details.
17
+
18
+ - Many regexps where modified to include recent changes in postal services, fix issues, narrow down formats that where unnecessary broad, allow for some looser cases such as optional whitespaces and making many of them case insensitive and removing countries with no postal codes - See PR #54. Thanks to ~ @ojsdude with some help from @dgilperez
19
+ - Allow the gem to generate test data from the formatters. See README ~ @ojsdude
20
+ - Officially support Ruby 3 and Rails 6.1
21
+
22
+ ## 0.3.3
23
+
24
+ - Fixes AR regex
25
+
5
26
  ## 0.3.2
6
27
 
7
28
  - Adds formatter for CA ~ @devthiago
data/README.md CHANGED
@@ -82,6 +82,23 @@ ValidatesZipcode.format('Sw1A 2aA', 'FR')
82
82
 
83
83
  At the moment not every country is supported. See [lib/validates_zipcode/formatter.rb](lib/validates_zipcode/formatter.rb) to find all available countries.
84
84
 
85
+ ### Test data
86
+
87
+ In order to generate test data, we suggest using the [regexp-examples gem](https://github.com/tom-lord/regexp-examples)
88
+ This dependency will allow you to create examples as follows:
89
+
90
+ ```ruby
91
+ require "regexp-examples"
92
+
93
+ ValidatesZipcode::CldrRegexpCollection::ZIPCODES_REGEX[:ES].examples
94
+
95
+ # => ["00000", "00001", "00002", "00003", ..., "44443", "44444"]
96
+
97
+ ValidatesZipcode::CldrRegexpCollection::ZIPCODES_REGEX[:ES].random_example
98
+
99
+ # => "27072"
100
+ ```
101
+
85
102
  ## Contributing
86
103
 
87
104
  1. Fork it
@@ -1,8 +1,7 @@
1
- # frozen_string_literal: true
2
1
  # This file was generated by Appraisal
3
2
 
4
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
5
4
 
6
- gem 'activemodel', '~> 4.2.0'
5
+ gem "activemodel", "~> 4.2.0"
7
6
 
8
- gemspec path: '../'
7
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- validates_zipcode (0.3.2)
4
+ validates_zipcode (0.5.1)
5
5
  activemodel (>= 4.2.0)
6
6
 
7
7
  GEM
@@ -81,4 +81,4 @@ DEPENDENCIES
81
81
  validates_zipcode!
82
82
 
83
83
  BUNDLED WITH
84
- 2.1.4
84
+ 2.2.22
@@ -1,8 +1,7 @@
1
- # frozen_string_literal: true
2
1
  # This file was generated by Appraisal
3
2
 
4
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
5
4
 
6
- gem 'activemodel', '~> 5.2.0'
5
+ gem "activemodel", "~> 5.2.0"
7
6
 
8
- gemspec path: '../'
7
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- validates_zipcode (0.3.2)
4
+ validates_zipcode (0.5.1)
5
5
  activemodel (>= 4.2.0)
6
6
 
7
7
  GEM
@@ -79,4 +79,4 @@ DEPENDENCIES
79
79
  validates_zipcode!
80
80
 
81
81
  BUNDLED WITH
82
- 2.1.4
82
+ 2.2.22
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activemodel", "~> 6.1.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ validates_zipcode (0.5.1)
5
+ activemodel (>= 4.2.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (6.1.3)
11
+ activesupport (= 6.1.3)
12
+ activesupport (6.1.3)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ appraisal (2.4.0)
19
+ bundler
20
+ rake
21
+ thor (>= 0.14.0)
22
+ ast (2.4.2)
23
+ concurrent-ruby (1.1.8)
24
+ diff-lcs (1.4.4)
25
+ i18n (1.8.9)
26
+ concurrent-ruby (~> 1.0)
27
+ minitest (5.14.4)
28
+ parallel (1.20.1)
29
+ parser (3.0.0.0)
30
+ ast (~> 2.4.1)
31
+ rack (2.2.3)
32
+ rainbow (3.0.0)
33
+ rake (13.0.3)
34
+ regexp_parser (2.1.1)
35
+ rexml (3.2.4)
36
+ rspec (3.10.0)
37
+ rspec-core (~> 3.10.0)
38
+ rspec-expectations (~> 3.10.0)
39
+ rspec-mocks (~> 3.10.0)
40
+ rspec-core (3.10.1)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-expectations (3.10.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-mocks (3.10.2)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-support (3.10.2)
49
+ rubocop (1.11.0)
50
+ parallel (~> 1.10)
51
+ parser (>= 3.0.0.0)
52
+ rainbow (>= 2.2.2, < 4.0)
53
+ regexp_parser (>= 1.8, < 3.0)
54
+ rexml
55
+ rubocop-ast (>= 1.2.0, < 2.0)
56
+ ruby-progressbar (~> 1.7)
57
+ unicode-display_width (>= 1.4.0, < 3.0)
58
+ rubocop-ast (1.4.1)
59
+ parser (>= 2.7.1.5)
60
+ rubocop-rails (2.9.1)
61
+ activesupport (>= 4.2.0)
62
+ rack (>= 1.1)
63
+ rubocop (>= 0.90.0, < 2.0)
64
+ ruby-progressbar (1.11.0)
65
+ thor (1.1.0)
66
+ tzinfo (2.0.4)
67
+ concurrent-ruby (~> 1.0)
68
+ unicode-display_width (2.0.0)
69
+ zeitwerk (2.4.2)
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ activemodel (~> 6.1.0)
76
+ appraisal
77
+ bundler
78
+ rake (>= 12.3.3)
79
+ rspec
80
+ rubocop
81
+ rubocop-rails
82
+ validates_zipcode!
83
+
84
+ BUNDLED WITH
85
+ 2.2.22
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activemodel", "~> 7.0.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ validates_zipcode (0.5.1)
5
+ activemodel (>= 4.2.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (7.0.3.1)
11
+ activesupport (= 7.0.3.1)
12
+ activesupport (7.0.3.1)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ appraisal (2.4.1)
18
+ bundler
19
+ rake
20
+ thor (>= 0.14.0)
21
+ ast (2.4.2)
22
+ concurrent-ruby (1.1.10)
23
+ diff-lcs (1.5.0)
24
+ i18n (1.11.0)
25
+ concurrent-ruby (~> 1.0)
26
+ json (2.6.2)
27
+ minitest (5.16.2)
28
+ parallel (1.22.1)
29
+ parser (3.1.2.0)
30
+ ast (~> 2.4.1)
31
+ rack (2.2.4)
32
+ rainbow (3.1.1)
33
+ rake (13.0.6)
34
+ regexp_parser (2.5.0)
35
+ rexml (3.2.5)
36
+ rspec (3.11.0)
37
+ rspec-core (~> 3.11.0)
38
+ rspec-expectations (~> 3.11.0)
39
+ rspec-mocks (~> 3.11.0)
40
+ rspec-core (3.11.0)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-expectations (3.11.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-mocks (3.11.1)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.11.0)
48
+ rspec-support (3.11.0)
49
+ rubocop (1.31.2)
50
+ json (~> 2.3)
51
+ parallel (~> 1.10)
52
+ parser (>= 3.1.0.0)
53
+ rainbow (>= 2.2.2, < 4.0)
54
+ regexp_parser (>= 1.8, < 3.0)
55
+ rexml (>= 3.2.5, < 4.0)
56
+ rubocop-ast (>= 1.18.0, < 2.0)
57
+ ruby-progressbar (~> 1.7)
58
+ unicode-display_width (>= 1.4.0, < 3.0)
59
+ rubocop-ast (1.19.1)
60
+ parser (>= 3.1.1.0)
61
+ rubocop-rails (2.15.2)
62
+ activesupport (>= 4.2.0)
63
+ rack (>= 1.1)
64
+ rubocop (>= 1.7.0, < 2.0)
65
+ ruby-progressbar (1.11.0)
66
+ thor (1.2.1)
67
+ tzinfo (2.0.4)
68
+ concurrent-ruby (~> 1.0)
69
+ unicode-display_width (2.2.0)
70
+
71
+ PLATFORMS
72
+ x86_64-darwin-20
73
+
74
+ DEPENDENCIES
75
+ activemodel (~> 7.0.0)
76
+ appraisal
77
+ bundler
78
+ rake (>= 12.3.3)
79
+ rspec
80
+ rubocop
81
+ rubocop-rails
82
+ validates_zipcode!
83
+
84
+ BUNDLED WITH
85
+ 2.2.22
@@ -1,8 +1,7 @@
1
- # frozen_string_literal: true
2
1
  # This file was generated by Appraisal
3
2
 
4
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
5
4
 
6
- gem 'activemodel', github: 'rails/rails'
5
+ gem "activemodel", github: "rails/rails"
7
6
 
8
- gemspec path: '../'
7
+ gemspec path: "../"
@@ -14,7 +14,7 @@ GIT
14
14
  PATH
15
15
  remote: ..
16
16
  specs:
17
- validates_zipcode (0.3.2)
17
+ validates_zipcode (0.5.1)
18
18
  activemodel (>= 4.2.0)
19
19
 
20
20
  GEM
@@ -86,4 +86,4 @@ DEPENDENCIES
86
86
  validates_zipcode!
87
87
 
88
88
  BUNDLED WITH
89
- 2.1.4
89
+ 2.2.22